private void printBinaryExpr(BinopExpr v) { String className = v.getClass().getSimpleName(); if (className.charAt(0) == 'J') { className = className.substring(1); } String oldName = varName; Value left = v.getOp1(); String v1 = printValueAssignment(left, "left"); Value right = v.getOp2(); String v2 = printValueAssignment(right, "right"); p.println("Value " + oldName + " = Jimple.v().new" + className + "(" + v1 + "," + v2 + ");"); varName = oldName; }
@Override public void caseIfStmt(IfStmt stmt) { // add constraint Value c = stmt.getCondition(); if (c instanceof BinopExpr) { BinopExpr bo = (BinopExpr) c; Value op1 = bo.getOp1(); Value op2 = bo.getOp2(); if (op1 instanceof Local && op2 instanceof Local) { DalvikTyper.v().addConstraint(bo.getOp1Box(), bo.getOp2Box()); } } }
public void handleBinop(BinopExpr binop, boolean ordered) { Node nop1 = fetchNode(binop.getOp1()); Node nop2 = fetchNode(binop.getOp2()); List<Node> children = new ArrayList<Node>(); children.add(nop1); children.add(nop2); setResult(new Node(binop, ordered, children)); }
private void caseBinopExpr(BinopExpr expr) { result = result.add(mightThrow(expr.getOp1())); result = result.add(mightThrow(expr.getOp2())); }
Value rightOp = binop.getOp2();
protected void checkExpr(Value v, Type t) { for (ValueBox vb : v.getUseBoxes()) { Value value = vb.getValue(); if (value instanceof Local) { // special case where the second operand is always of type integer if ((v instanceof ShrExpr || v instanceof ShlExpr || v instanceof UshrExpr) && ((BinopExpr) v).getOp2() == value) { // Debug.printDbg("setting type of operand two of shift expression to integer", value); DalvikTyper.v().setType(vb, IntType.v(), true); continue; } DalvikTyper.v().setType(vb, t, true); } else if (value instanceof UntypedConstant) { UntypedConstant uc = (UntypedConstant) value; // special case where the second operand is always of type integer if ((v instanceof ShrExpr || v instanceof ShlExpr || v instanceof UshrExpr) && ((BinopExpr) v).getOp2() == value) { UntypedIntOrFloatConstant ui = (UntypedIntOrFloatConstant) uc; vb.setValue(ui.toIntConstant()); continue; } vb.setValue(uc.defineType(t)); } } }
private void caseBinopDivExpr(BinopExpr expr) { // Factors out code common to caseDivExpr and caseRemExpr. // The checks against constant divisors would perhaps be // better performed in a later pass, post-constant-propagation. Value divisor = expr.getOp2(); Type divisorType = divisor.getType(); if (divisorType instanceof UnknownType) { result = result.add(mgr.ARITHMETIC_EXCEPTION); } else if ((divisorType instanceof IntegerType) && ((!(divisor instanceof IntConstant)) || (((IntConstant) divisor).equals(INT_CONSTANT_ZERO)))) { result = result.add(mgr.ARITHMETIC_EXCEPTION); } else if ((divisorType == LongType.v()) && ((!(divisor instanceof LongConstant)) || (((LongConstant) divisor).equals(LONG_CONSTANT_ZERO)))) { result = result.add(mgr.ARITHMETIC_EXCEPTION); } caseBinopExpr(expr); }
} else if (rhs instanceof BinopExpr) { BinopExpr be = (BinopExpr) rhs; Value lop = be.getOp1(), rop = be.getOp2(); if (lop instanceof Local) { this.addDepend((Local) lop, assignmentIdx);
final BinopExpr binExpr = (BinopExpr) op; final Value op1 = binExpr.getOp1(); final Value op2 = binExpr.getOp2();
BinopExpr be = (BinopExpr) c; Value op1 = be.getOp1(); Value op2 = be.getOp2(); if (op1 instanceof UntypedConstant || op2 instanceof UntypedConstant) {
BinopExpr aer = (BinopExpr) assignStmt.getRightOp(); if (isConstZero(aer.getOp1())) { assignStmt.setRightOp(aer.getOp2()); } else if (isConstZero(aer.getOp2())) { assignStmt.setRightOp(aer.getOp1()); if (isConstZero(aer.getOp2())) { assignStmt.setRightOp(aer.getOp1()); if (isConstZero(aer.getOp1())) { assignStmt.setRightOp(getZeroConst(assignStmt.getLeftOp().getType())); } else if (isConstZero(aer.getOp2())) { assignStmt.setRightOp(getZeroConst(assignStmt.getLeftOp().getType()));
BinopExpr expr = (BinopExpr) rvalue; Value op1 = expr.getOp1(); Value op2 = expr.getOp2();
Value rv = expr.getOp2();
Value rv = expr.getOp2();
Value rv = expr.getOp2();
Value rv = expr.getOp2();
private void handleBinopExpr(BinopExpr be, Stmt stmt, Type tlhs) { Value opl = be.getOp1(), opr = be.getOp2(); Type tl = AugEvalFunction.eval_(this.tg, opl, stmt, this.jb), tr = AugEvalFunction.eval_(this.tg, opr, stmt, this.jb); if (be instanceof AddExpr || be instanceof SubExpr || be instanceof MulExpr || be instanceof DivExpr || be instanceof RemExpr || be instanceof GeExpr || be instanceof GtExpr || be instanceof LeExpr || be instanceof LtExpr || be instanceof ShlExpr || be instanceof ShrExpr || be instanceof UshrExpr) { if (tlhs instanceof IntegerType) { be.setOp1(this.uv.visit(opl, IntType.v(), stmt)); be.setOp2(this.uv.visit(opr, IntType.v(), stmt)); } } else if (be instanceof CmpExpr || be instanceof CmpgExpr || be instanceof CmplExpr) { // No checks in the original assigner } else if (be instanceof AndExpr || be instanceof OrExpr || be instanceof XorExpr) { be.setOp1(this.uv.visit(opl, tlhs, stmt)); be.setOp2(this.uv.visit(opr, tlhs, stmt)); } else if (be instanceof EqExpr || be instanceof NeExpr) { if (tl instanceof BooleanType && tr instanceof BooleanType) { } else if (tl instanceof Integer1Type || tr instanceof Integer1Type) { } else if (tl instanceof IntegerType) { be.setOp1(this.uv.visit(opl, IntType.v(), stmt)); be.setOp2(this.uv.visit(opr, IntType.v(), stmt)); } } }
walk_value(a, be.getOp2()); a.analyseBinopExpr(be); } else if (e instanceof UnopExpr) {