@Override public void jimplify(DexBody body) { if (!(instruction instanceof Instruction12x)) { throw new IllegalArgumentException("Expected Instruction12x but got: " + instruction.getClass()); } Instruction12x cmpInstr = (Instruction12x) instruction; int dest = cmpInstr.getRegisterA(); Local source = body.getRegisterLocal(cmpInstr.getRegisterB()); Value expr = getExpression(source); AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr); assign.addTag(getTag()); setUnit(assign); addTags(assign); body.add(assign); if (IDalvikTyper.ENABLE_DVKTYPER) { /* * int op = (int)instruction.getOpcode().value; //DalvikTyper.v().captureAssign((JAssignStmt)assign, op); JAssignStmt * jass = (JAssignStmt)assign; DalvikTyper.v().setType((expr instanceof JCastExpr) ? ((JCastExpr) expr).getOpBox() : * ((UnopExpr) expr).getOpBox(), opUnType[op - 0x7b], true); DalvikTyper.v().setType(jass.leftBox, resUnType[op - * 0x7b], false); */ } }
constructStmt.addTag(s.getTag("SourceLnPosTag"));
@Override public void jimplify(DexBody body) { if (!(instruction instanceof Instruction12x)) { throw new IllegalArgumentException("Expected Instruction12x but got: " + instruction.getClass()); } Instruction12x binOp2AddrInstr = (Instruction12x) instruction; int dest = binOp2AddrInstr.getRegisterA(); Local source1 = body.getRegisterLocal(binOp2AddrInstr.getRegisterA()); Local source2 = body.getRegisterLocal(binOp2AddrInstr.getRegisterB()); Value expr = getExpression(source1, source2); AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr); assign.addTag(getTag()); setUnit(assign); addTags(assign); body.add(assign); /* * if (IDalvikTyper.ENABLE_DVKTYPER) { BinopExpr bexpr = (BinopExpr)expr; short op = instruction.getOpcode().value; * DalvikTyper.v().setType(bexpr.getOp1Box(), op1BinType[op-0xb0], true); DalvikTyper.v().setType(bexpr.getOp2Box(), * op2BinType[op-0xb0], true); DalvikTyper.v().setType(assign.getLeftOpBox(), resBinType[op-0xb0], false); } */ }
@Override public void jimplify(DexBody body) { if (!(instruction instanceof Instruction22s) && !(instruction instanceof Instruction22b)) { throw new IllegalArgumentException("Expected Instruction22s or Instruction22b but got: " + instruction.getClass()); } NarrowLiteralInstruction binOpLitInstr = (NarrowLiteralInstruction) this.instruction; int dest = ((TwoRegisterInstruction) instruction).getRegisterA(); int source = ((TwoRegisterInstruction) instruction).getRegisterB(); Local source1 = body.getRegisterLocal(source); IntConstant constant = IntConstant.v(binOpLitInstr.getNarrowLiteral()); Value expr = getExpression(source1, constant); AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr); assign.addTag(getTag()); setUnit(assign); addTags(assign); body.add(assign); /* * if (IDalvikTyper.ENABLE_DVKTYPER) { Debug.printDbg(IDalvikTyper.DEBUG, "constraint: "+ assign); * * int op = (int)instruction.getOpcode().value; if (op >= 0xd8) { op -= 0xd8; } else { op -= 0xd0; } BinopExpr bexpr = * (BinopExpr)expr; //body.dvkTyper.setType((op == 1) ? bexpr.getOp2Box() : bexpr.getOp1Box(), op1BinType[op]); * DalvikTyper.v().setType(((JAssignStmt)assign).leftBox, op1BinType[op], false); * * } */ }
@Override public void jimplify(DexBody body) { if (!(instruction instanceof Instruction23x)) { throw new IllegalArgumentException("Expected Instruction23x but got: " + instruction.getClass()); } Instruction23x binOpInstr = (Instruction23x) instruction; int dest = binOpInstr.getRegisterA(); Local source1 = body.getRegisterLocal(binOpInstr.getRegisterB()); Local source2 = body.getRegisterLocal(binOpInstr.getRegisterC()); Value expr = getExpression(source1, source2); AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), expr); assign.addTag(getTag()); setUnit(assign); addTags(assign); body.add(assign); /* * if (IDalvikTyper.ENABLE_DVKTYPER) { int op = (int)instruction.getOpcode().value; BinopExpr bexpr = (BinopExpr)expr; * JAssignStmt jassign = (JAssignStmt)assign; DalvikTyper.v().setType(bexpr.getOp1Box(), op1BinType[op-0x90], true); * DalvikTyper.v().setType(bexpr.getOp2Box(), op2BinType[op-0x90], true); DalvikTyper.v().setType(jassign.leftBox, * resBinType[op-0x90], false); } */ }
@Override public void jimplify(DexBody body) { if (!(instruction instanceof Instruction23x)) { throw new IllegalArgumentException("Expected Instruction23x but got: " + instruction.getClass()); } Instruction23x aPutInstr = (Instruction23x) instruction; int source = aPutInstr.getRegisterA(); Local arrayBase = body.getRegisterLocal(aPutInstr.getRegisterB()); Local index = body.getRegisterLocal(aPutInstr.getRegisterC()); ArrayRef arrayRef = Jimple.v().newArrayRef(arrayBase, index); Local sourceValue = body.getRegisterLocal(source); AssignStmt assign = getAssignStmt(body, sourceValue, arrayRef); if (aPutInstr.getOpcode() == Opcode.APUT_OBJECT) { assign.addTag(new ObjectOpTag()); } setUnit(assign); addTags(assign); body.add(assign); if (IDalvikTyper.ENABLE_DVKTYPER) { DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox()); DalvikTyper.v().setType(arrayRef.getIndexBox(), IntType.v(), true); } }
@Override public void jimplify(DexBody body) throws InvalidDalvikBytecodeException { if (!(instruction instanceof Instruction23x)) { throw new IllegalArgumentException("Expected Instruction23x but got: " + instruction.getClass()); } Instruction23x aGetInstr = (Instruction23x) instruction; int dest = aGetInstr.getRegisterA(); Local arrayBase = body.getRegisterLocal(aGetInstr.getRegisterB()); Local index = body.getRegisterLocal(aGetInstr.getRegisterC()); ArrayRef arrayRef = Jimple.v().newArrayRef(arrayBase, index); Local l = body.getRegisterLocal(dest); AssignStmt assign = Jimple.v().newAssignStmt(l, arrayRef); if (aGetInstr.getOpcode() == Opcode.AGET_OBJECT) { assign.addTag(new ObjectOpTag()); } setUnit(assign); addTags(assign); body.add(assign); if (IDalvikTyper.ENABLE_DVKTYPER) { DalvikTyper.v().addConstraint(assign.getLeftOpBox(), assign.getRightOpBox()); DalvikTyper.v().setType(arrayRef.getIndexBox(), IntType.v(), true); } }
@Override public void jimplify(DexBody body) { TwoRegisterInstruction i = (TwoRegisterInstruction) instruction; int dest = i.getRegisterA(); int source = i.getRegisterB(); Type targetType = getTargetType(); CastExpr cast = Jimple.v().newCastExpr(body.getRegisterLocal(source), targetType); AssignStmt assign = Jimple.v().newAssignStmt(body.getRegisterLocal(dest), cast); assign.addTag(getTag()); setUnit(assign); addTags(assign); body.add(assign); if (IDalvikTyper.ENABLE_DVKTYPER) { DalvikTyper.v().setType(assign.getLeftOpBox(), cast.getType(), false); // DalvikTyper.v().captureAssign((JAssignStmt)assign, op); } }
assign.addTag(getTag());
constructStmt.addTag(s.getTag("SourceLnPosTag"));
constructStmt.addTag(s.getTag("SourceLnPosTag"));