@Override public IntConstant cmpg(RealConstant constant) { assertInstanceOf(constant); final float cValue = ((FloatConstant) constant).value; if (this.value < cValue) { return IntConstant.v(-1); } else if (this.value == cValue) { return IntConstant.v(0); } else { return IntConstant.v(1); } }
static Local base(Stmt s) { InvokeStmt is = (InvokeStmt) s; InstanceInvokeExpr expr = (InstanceInvokeExpr) is.getInvokeExpr(); return (Local) expr.getBase(); }
/** * Returns a needed constant given a type and val */ @Override protected soot.jimple.Constant getConstant(soot.Type type, int val) { if (type instanceof soot.DoubleType) { return soot.jimple.DoubleConstant.v(val); } else if (type instanceof soot.FloatType) { return soot.jimple.FloatConstant.v(val); } else if (type instanceof soot.LongType) { return soot.jimple.LongConstant.v(val); } else { return soot.jimple.IntConstant.v(val); } }
private boolean sameCondLocal(Stmt s1, Stmt s2) { AssignStmt as1 = (AssignStmt) s1; IfStmt is2 = (IfStmt) s2; if (is2.getCondition() instanceof BinopExpr) { BinopExpr bs2 = (BinopExpr) is2.getCondition(); if (as1.getLeftOp().equals(bs2.getOp1())) { return true; } } return false; } }
/** * returns bitwise negation of an integer * * @param source * @return */ private Value getNotIntExpr(Local source) { return Jimple.v().newXorExpr(source, IntConstant.v(-1)); }
public GotoStmt newGotoStmt(GotoStmt s) { return Jimple.v().newGotoStmt(s.getTarget()); }
/** * returns bitwise negation of a long * * @param source * @return */ private Value getNotLongExpr(Local source) { return Jimple.v().newXorExpr(source, LongConstant.v(-1l)); }
public final void caseThrowStmt(ThrowStmt s) { statement = s; caseThrowStmt((Local) s.getOp()); } }
public final void caseInvokeStmt(InvokeStmt s) { statement = s; caseInvokeStmt(null, s.getInvokeExpr()); }
@Override public IntConstant cmpl(RealConstant constant) { assertInstanceOf(constant); final double cValue = ((DoubleConstant) constant).value; if (this.value > cValue) { return IntConstant.v(1); } else if (this.value == cValue) { return IntConstant.v(0); } else { return IntConstant.v(-1); } }
public void caseIntConstant(IntConstant v) { if (v.value == -1) { emit("iconst_m1", 1); } else if (v.value >= 0 && v.value <= 5) { emit("iconst_" + v.value, 1); } else if (v.value >= Byte.MIN_VALUE && v.value <= Byte.MAX_VALUE) { emit("bipush " + v.value, 1); } else if (v.value >= Short.MIN_VALUE && v.value <= Short.MAX_VALUE) { emit("sipush " + v.value, 1); } else { emit("ldc " + v.toString(), 1); } }
@Override public IntConstant cmpl(RealConstant constant) { assertInstanceOf(constant); final float cValue = ((FloatConstant) constant).value; if (this.value > cValue) { return IntConstant.v(1); } else if (this.value == cValue) { return IntConstant.v(0); } else { return IntConstant.v(-1); } }
@Override public IntConstant cmpg(RealConstant constant) { assertInstanceOf(constant); final double cValue = ((DoubleConstant) constant).value; if (this.value < cValue) { return IntConstant.v(-1); } else if (this.value == cValue) { return IntConstant.v(0); } else { return IntConstant.v(1); } }