public void visitFillArrayDataPayloadInsn(int currentAddress, int opcode, Object data, int size, int elementWidth) { short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); codeOut.write(elementWidthUnit); codeOut.write((byte[]) data); break; codeOut.write((short[]) data); break; codeOut.write((int[]) data); break; codeOut.write((long[]) data); break;
public void visitPackedSwitchPayloadInsn(int currentAddress, int opcode, int firstKey, int[] targets) { int baseAddress = codeOut.baseAddressForCursor(); short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); codeOut.write(InstructionCodec.asUnsignedUnit(targets.length)); codeOut.writeInt(firstKey); if (this.hasPromoter) { for (int target : targets) { target = this.insnPromoter.getPromotedAddress(target); codeOut.writeInt(target - baseAddress); } } else { for (int target : targets) { codeOut.writeInt(target - baseAddress); } } }
/** * Writes the contents of the given array. */ public void write(short[] data) { for (short unit : data) { write(unit); } }
public void visitSparseSwitchPayloadInsn(int currentAddress, int opcode, int[] keys, int[] targets) { int baseAddress = codeOut.baseAddressForCursor(); short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); codeOut.write(InstructionCodec.asUnsignedUnit(targets.length)); for (int key : keys) { codeOut.writeInt(key); } if (this.hasPromoter) { for (int target : targets) { target = this.insnPromoter.getPromotedAddress(target); codeOut.writeInt(target - baseAddress); } } else { for (int target : targets) { codeOut.writeInt(target - baseAddress); } } }
public void visitRegisterRangeInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int registerCount) { switch (opcode) { case Opcodes.FILLED_NEW_ARRAY_RANGE: case Opcodes.INVOKE_VIRTUAL_RANGE: case Opcodes.INVOKE_SUPER_RANGE: case Opcodes.INVOKE_DIRECT_RANGE: case Opcodes.INVOKE_STATIC_RANGE: case Opcodes.INVOKE_INTERFACE_RANGE: { short indexUnit = (short) index; codeOut.write( InstructionCodec.codeUnit(opcode, registerCount), indexUnit, InstructionCodec.getAUnit(a)); break; } default: { throw new IllegalStateException("unexpected opcode: " + Hex.u2or4(opcode)); } } }
public void visitFiveRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b, int c, int d, int e) { switch (opcode) { case Opcodes.FILLED_NEW_ARRAY: case Opcodes.INVOKE_VIRTUAL: case Opcodes.INVOKE_SUPER: case Opcodes.INVOKE_DIRECT: case Opcodes.INVOKE_STATIC: case Opcodes.INVOKE_INTERFACE: { short indexUnit = (short) index; codeOut.write( InstructionCodec.codeUnit( opcode, InstructionCodec.makeByte(e, 5) ), indexUnit, InstructionCodec.codeUnit(a, b, c, d) ); break; } default: { throw new IllegalStateException("unexpected opcode: " + Hex.u2or4(opcode)); } } }
public void visitFourRegisterInsn(int currentAddress, int opcode, int index, int indexType, int target, long literal, int a, int b, int c, int d) { switch (opcode) { case Opcodes.FILLED_NEW_ARRAY: case Opcodes.INVOKE_VIRTUAL: case Opcodes.INVOKE_SUPER: case Opcodes.INVOKE_DIRECT: case Opcodes.INVOKE_STATIC: case Opcodes.INVOKE_INTERFACE: { short indexUnit = (short) index; codeOut.write( InstructionCodec.codeUnit( opcode, InstructionCodec.makeByte(0, 4) ), indexUnit, InstructionCodec.codeUnit(a, b, c, d) ); break; } default: { throw new IllegalStateException("unexpected opcode: " + Hex.u2or4(opcode)); } } }
case Opcodes.RETURN_VOID: { short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit); break; if (relativeTarget != (short) relativeTarget) { short opcodeUnit = (short) Opcodes.GOTO_32; codeOut.write(opcodeUnit, InstructionCodec.unit0(relativeTarget), InstructionCodec.unit1(relativeTarget)); } else { short shortRelativeTarget = (short) relativeTarget; short opcodeUnit = (short) Opcodes.GOTO_16; codeOut.write(opcodeUnit, shortRelativeTarget); codeOut.write(InstructionCodec.codeUnit(opcode, relativeTarget)); codeOut.write(InstructionCodec.codeUnit(opcode, relativeTarget)); if (relativeTarget != (short) relativeTarget) { short opcodeUnit = (short) Opcodes.GOTO_32; codeOut.write(opcodeUnit, InstructionCodec.unit0(relativeTarget), InstructionCodec.unit1(relativeTarget)); } else { short shortRelativeTarget = (short) relativeTarget; short opcodeUnit = (short) opcode; codeOut.write(opcodeUnit, shortRelativeTarget); codeOut.write(opcodeUnit, relativeTarget); int relativeTarget = InstructionCodec.getTarget(target, codeOut.cursor()); short opcodeUnit = (short) opcode;
case Opcodes.REM_DOUBLE_2ADDR: { short opcodeUnit = (short) opcode; codeOut.write( InstructionCodec.codeUnit( opcodeUnit, case Opcodes.MOVE_WIDE_FROM16: case Opcodes.MOVE_OBJECT_FROM16: { codeOut.write( InstructionCodec.codeUnit(opcode, a), InstructionCodec.getBUnit(b) case Opcodes.SHR_INT_LIT8: case Opcodes.USHR_INT_LIT8: { codeOut.write( InstructionCodec.codeUnit(opcode, a), InstructionCodec.codeUnit(b, InstructionCodec.getLiteralByte(literal)) case Opcodes.IF_LE: { short relativeTarget = InstructionCodec.getTargetUnit(target, codeOut.cursor()); codeOut.write( InstructionCodec.codeUnit( opcode, case Opcodes.OR_INT_LIT16: case Opcodes.XOR_INT_LIT16: { codeOut.write( InstructionCodec.codeUnit( opcode,
case Opcodes.CONST_4: { short opcodeUnit = (short) opcode; codeOut.write( InstructionCodec.codeUnit( opcodeUnit, case Opcodes.MONITOR_EXIT: case Opcodes.THROW: { codeOut.write(InstructionCodec.codeUnit(opcode, a)); break; case Opcodes.IF_LEZ: { short relativeTarget = InstructionCodec.getTargetUnit(target, codeOut.cursor()); codeOut.write(InstructionCodec.codeUnit(opcode, a), relativeTarget); break; codeOut.write(InstructionCodec.codeUnit(opcode, a), InstructionCodec.getLiteralUnit(literal)); break; int shift = (opcode == Opcodes.CONST_HIGH16) ? 16 : 48; short literalShifted = (short) (literal >> shift); codeOut.write(InstructionCodec.codeUnit(opcode, a), literalShifted); break; if (this.hasPromoter) { if (index > 0xFFFF) { codeOut.write( InstructionCodec.codeUnit(Opcodes.CONST_STRING_JUMBO, a), InstructionCodec.unit0(index),