def p_invokevirtual(p): '''invokevirtual : INVOKEVIRTUAL SHORT | INVOKEVIRTUAL BYTE | INVOKEVIRTUAL IDENTIFIER''' isString = False cp = cf.constant_pool print("Inside invokevirtual") try: p[2] = int(p[2]) except: isString = True if not isString: p[0] = opc_compile(p[1]) p[0] += struct.pack('>h', p[2]) else: print("inside invokevirtual 2") p[0] = opc_compile(p[1]) method_name = None found = False mri_index = 1 for i in cp.entries[1:]: if i.tag == CONSTANT_METHODREF: nat_index = i.name_and_type_index method_name = cp.entries[ cp.entries[nat_index].name_index].get_bytes_as_str() print("method_name = %s" % method_name) if method_name == p[2]: found = True break mri_index += 1 if found: print("Found on index %d" % mri_index) p[0] += struct.pack('>h', mri_index)
def p_invokevirtual(p): '''invokevirtual : INVOKEVIRTUAL SHORT | INVOKEVIRTUAL BYTE | INVOKEVIRTUAL IDENTIFIER''' isString = False cp = cf.constant_pool print("Inside invokevirtual") try: p[2] = int(p[2]) except: isString = True if not isString: p[0] = opc_compile(p[1]) p[0] += struct.pack('>h', p[2]) else: print("inside invokevirtual 2") p[0] = opc_compile(p[1]) method_name = None found = False mri_index = 1 for i in cp.entries[1:]: if i.tag == CONSTANT_METHODREF: nat_index = i.name_and_type_index method_name = cp.entries[cp.entries[nat_index].name_index].get_bytes_as_str() print("method_name = %s" % method_name) if method_name == p[2]: found = True break mri_index += 1 if found: print("Found on index %d" % mri_index) p[0] += struct.pack('>h', mri_index)
def p_aload_0(p): '''aload_0 : ALOAD_0''' p[0] = opc_compile(p[1])
def p_astore_0(p): '''astore_0 : ASTORE_0''' p[0] = opc_compile(p[1])
def p_astore_2(p): '''astore_2 : ASTORE_2''' p[0] = opc_compile(p[1])
def p_invokespecial(p): '''invokespecial : INVOKESPECIAL SHORT | INVOKESPECIAL BYTE''' p[0] = opc_compile(p[1]) p[0] += struct.pack('>h', p[2])
def p_ireturn(p): '''ireturn : IRETURN''' p[0] = opc_compile(p[1])
def p_iload_2(p): '''iload_2 : ILOAD_2''' p[0] = opc_compile(p[1])
def p_istore_1(p): '''istore_1 : ISTORE_1''' p[0] = opc_compile(p[1])
def p_iload_0(p): '''iload_0 : ILOAD_0''' p[0] = opc_compile(p[1])
def p_iload_1(p): '''iload_1 : ILOAD_1''' p[0] = opc_compile(p[1])
def p_aload_2(p): '''aload_2 : ALOAD_2''' p[0] = opc_compile(p[1])
def p_aload_3(p): '''aload_3 : ALOAD_3''' p[0] = opc_compile(p[1])
def p_aload_1(p): '''aload_1 : ALOAD_1''' p[0] = opc_compile(p[1])
def p_astore_3(p): '''astore_3 : ASTORE_3''' p[0] = opc_compile(p[1])
def p_iload_3(p): '''iload_3 : ILOAD_3''' p[0] = opc_compile(p[1])
def p_isub(p): '''isub : ISUB''' p[0] = opc_compile(p[1])
def p_istore_0(p): '''istore_0 : ISTORE_0''' p[0] = opc_compile(p[1])
def p_ldc(p): '''ldc : LDC BYTE''' p[0] = opc_compile(p[1]) p[0] += bytes([p[2]])
def p_istore_2(p): '''istore_2 : ISTORE_2''' p[0] = opc_compile(p[1])
def p_astore_1(p): '''astore_1 : ASTORE_1''' p[0] = opc_compile(p[1])
def p_istore_3(p): '''istore_3 : ISTORE_3''' p[0] = opc_compile(p[1])
def p_getstatic(p): '''getstatic : GETSTATIC SHORT | GETSTATIC BYTE''' p[0] = opc_compile(p[1]) p[0] += struct.pack('>h', p[2])
def p_new(p): '''new : NEW SHORT | NEW BYTE''' p[0] = opc_compile(p[1]) p[0] += struct.pack('>h', p[2])
def p_dup(p): '''dup : DUP''' p[0] = opc_compile(p[1])
def p_bipush(p): '''bipush : BIPUSH BYTE''' p[0] = opc_compile(p[1]) p[0] += bytes([p[2]])
def p_return(p): '''return : RETURN''' p[0] = opc_compile(p[1])
def p_nop(p): '''nop : NOP''' p[0] = opc_compile(p[1])