Example #1
0
 @Override
 public void visit(NegateInstruction insn) {
   switch (insn.getOperandType()) {
     case INT:
       assign(
           castToInteger(
               Expr.unary(UnaryOperation.NEGATE, Expr.var(insn.getOperand().getIndex()))),
           insn.getReceiver());
       break;
     case LONG:
       assign(
           Expr.unary(UnaryOperation.NEGATE_LONG, Expr.var(insn.getOperand().getIndex())),
           insn.getReceiver());
       break;
     default:
       assign(
           Expr.unary(UnaryOperation.NEGATE, Expr.var(insn.getOperand().getIndex())),
           insn.getReceiver());
       break;
   }
 }
Example #2
0
 @Override
 public void visit(CastIntegerInstruction insn) {
   Expr value = Expr.var(insn.getValue().getIndex());
   switch (insn.getDirection()) {
     case FROM_INTEGER:
       switch (insn.getTargetType()) {
         case BYTE:
           value = Expr.unary(UnaryOperation.INT_TO_BYTE, value);
           break;
         case SHORT:
           value = Expr.unary(UnaryOperation.INT_TO_SHORT, value);
           break;
         case CHARACTER:
           value = Expr.unary(UnaryOperation.INT_TO_CHAR, value);
           break;
       }
       break;
     case TO_INTEGER:
       break;
   }
   assign(value, insn.getReceiver());
 }
Example #3
0
 @Override
 public void visit(NullCheckInstruction insn) {
   assign(
       Expr.unary(UnaryOperation.NULL_CHECK, Expr.var(insn.getValue().getIndex())),
       insn.getReceiver());
 }
Example #4
0
 private Expr castFromLong(Expr value) {
   return Expr.unary(UnaryOperation.LONG_TO_NUM, value);
 }
Example #5
0
 private Expr castIntToLong(Expr value) {
   return Expr.unary(UnaryOperation.INT_TO_LONG, value);
 }
Example #6
0
 private Expr castLongToInt(Expr value) {
   return Expr.unary(UnaryOperation.LONG_TO_INT, value);
 }
Example #7
0
 @Override
 public void visit(ArrayLengthInstruction insn) {
   assign(
       Expr.unary(UnaryOperation.LENGTH, Expr.var(insn.getArray().getIndex())),
       insn.getReceiver());
 }