@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) { return new BuilderInstruction21lh( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
public static BuilderInstruction buildConstant(double value, int register) { long longBits = Double.doubleToLongBits(value); String binaryValue = Long.toBinaryString(longBits); BuilderInstruction result; if (binaryValue.endsWith(LAST_48_BITS_ZERO)) { result = new BuilderInstruction21lh(Opcode.CONST_WIDE_HIGH16, register, longBits); } else { result = new BuilderInstruction51l(Opcode.CONST_WIDE, register, longBits); } return result; }
@Test public void withValueWithLast48BitsZero() { double value = Math.pow(2, 48); long longBits = Double.doubleToLongBits(value); Instruction expected = new BuilderInstruction21lh(Opcode.CONST_WIDE_HIGH16, REGISTER, longBits); Instruction actual = ConstantBuilder.buildConstant(value, REGISTER); testEquals(expected, actual); } }
@Test public void withHeapItemWithDoubleTypeAndLongValue() { double doubleValue = Math.pow(2, 15); long longValue = (long) doubleValue; long longBits = Double.doubleToLongBits(doubleValue); Instruction expected = new BuilderInstruction21lh(Opcode.CONST_WIDE_HIGH16, REGISTER, longBits); HeapItem value = new HeapItem(longValue, "D"); int address = 0; ExecutionGraphManipulator manipulator = getMockedGraph(address, value); Instruction actual = ConstantBuilder.buildConstant(address, manipulator); testEquals(expected, actual); }
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction21lh(opcode, regA, litB));
@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) { return new BuilderInstruction21lh( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) { return new BuilderInstruction21lh( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) { return new BuilderInstruction21lh( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
@Nonnull private BuilderInstruction21lh newBuilderInstruction21lh(@Nonnull Instruction21lh instruction) { return new BuilderInstruction21lh( instruction.getOpcode(), instruction.getRegisterA(), instruction.getWideLiteral()); }
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction21lh(opcode, regA, litB));
method_stack.peek().methodBuilder.addInstruction(new BuilderInstruction21lh(opcode, regA, litB));