/** * Constructs a ThisRef(RefType) grammar chunk. */ public ThisRef newThisRef(RefType t) { return Jimple.v().newThisRef(t); }
public void outAEntermonitorStatement(AEntermonitorStatement node) { Value op = (Value) mProductions.removeLast(); Unit u = Jimple.v().newEnterMonitorStmt(op); mProductions.addLast(u); }
public void outAExitmonitorStatement(AExitmonitorStatement node) { Value op = (Value) mProductions.removeLast(); Unit u = Jimple.v().newExitMonitorStmt(op); mProductions.addLast(u); }
public void outAArrayNewExpr(AArrayNewExpr node) { Value size = (Value) mProductions.removeLast(); Type type = (Type) mProductions.removeLast(); mProductions.addLast(Jimple.v().newNewArrayExpr(type, size)); }
public JNewMultiArrayExpr(ArrayType type, List<? extends Value> sizes) { super(type, new ValueBox[sizes.size()]); for (int i = 0; i < sizes.size(); i++) { sizeBoxes[i] = Jimple.v().newImmediateBox(sizes.get(i)); } }
Local newStackLocal() { Integer idx = nextLocal++; Local l = Jimple.v().newLocal("$stack" + idx, UnknownType.v()); locals.put(idx, l); return l; }
@Override public void jimplify(DexBody body) { int dest = ((OneRegisterInstruction) instruction).getRegisterA(); Local l = body.getRegisterLocal(dest); stmtToRetype = Jimple.v().newIdentityStmt(l, Jimple.v().newCaughtExceptionRef()); setUnit(stmtToRetype); addTags(stmtToRetype); body.add(stmtToRetype); if (IDalvikTyper.ENABLE_DVKTYPER) { DalvikTyper.v().setType(stmtToRetype.getLeftOpBox(), RefType.v("java.lang.Throwable"), false); } }
/** * create body and make it be active */ private void createBody(soot.SootMethod sootMethod) { body = soot.jimple.Jimple.v().newBody(sootMethod); sootMethod.setActiveBody(body); }
private Local insertCast(Value oldvalue, Type oldtype, Type type, Stmt stmt) { Local newlocal1 = Jimple.v().newLocal("tmp", oldtype); Local newlocal2 = Jimple.v().newLocal("tmp", type); stmtBody.getLocals().add(newlocal1); stmtBody.getLocals().add(newlocal2); Unit u = Util.findFirstNonIdentityUnit(this.stmtBody, stmt); stmtBody.getUnits().insertBefore(Jimple.v().newAssignStmt(newlocal1, oldvalue), u); stmtBody.getUnits().insertBefore(Jimple.v().newAssignStmt(newlocal2, Jimple.v().newCastExpr(newlocal1, type)), u); return newlocal2; } }
public soot.Local emitThis(TypeDecl typeDecl) { if(thisName == null) { thisName = newLocal("this", typeDecl.getSootType()); if(body.getMethod().isStatic()) add(Jimple.v().newIdentityStmt(thisName, Jimple.v().newParameterRef(typeDecl.getSootType(), 0))); else add(Jimple.v().newIdentityStmt(thisName, Jimple.v().newThisRef(typeDecl.sootRef()))); } return thisName; }
public soot.jimple.StaticInvokeExpr newStaticInvokeExpr(SootMethodRef method, java.util.List args, ASTNode location) { soot.jimple.StaticInvokeExpr expr = Jimple.v().newStaticInvokeExpr(method, args); createTag(expr, location); for(int i = 0; i < args.size(); i++) { soot.tagkit.Tag tag = getTag((Value)args.get(i)); if(tag != null) expr.getArgBox(i).addTag(tag); } return expr; }
public soot.jimple.InterfaceInvokeExpr newInterfaceInvokeExpr(Local base, SootMethodRef method, java.util.List args, ASTNode location) { soot.jimple.InterfaceInvokeExpr expr = Jimple.v().newInterfaceInvokeExpr(base, method, args); createTag(expr, location); for(int i = 0; i < args.size(); i++) { soot.tagkit.Tag tag = getTag((Value)args.get(i)); if(tag != null) expr.getArgBox(i).addTag(tag); } return expr; }
Local getLocalCreatingIfNecessary(JimpleBody listBody, String name, Type type) { Local l = getLocalUnsafe(listBody, name); if (l != null) { if (!l.getType().equals(type)) { throw new RuntimeException("The body already declares this local name with a different type."); } } else { l = Jimple.v().newLocal(name, type); listBody.getLocals().add(l); } return l; }
public Value createJimpleConstantValue(cp_info[] constant_pool) { CONSTANT_Class_info cc = (CONSTANT_Class_info) (constant_pool[class_index]); CONSTANT_NameAndType_info cn = (CONSTANT_NameAndType_info) (constant_pool[name_and_type_index]); String className = cc.toString(constant_pool); String nameAndType = cn.toString(constant_pool); String name = nameAndType.substring(0, nameAndType.indexOf(":")); String typeName = nameAndType.substring(nameAndType.indexOf(":") + 1); Type type = Util.v().jimpleTypeOfFieldDescriptor(typeName); return Jimple.v().newStaticFieldRef(Scene.v().makeFieldRef(Scene.v().getSootClass(className), name, type, true)); }
public soot.jimple.ThrowStmt newThrowStmt(Value op, ASTNode location) { soot.jimple.ThrowStmt stmt = Jimple.v().newThrowStmt(op); soot.tagkit.Tag tag = getTag(op); if(tag != null) stmt.getOpBox().addTag(tag); return stmt; }
public soot.jimple.EnterMonitorStmt newEnterMonitorStmt(Value op, ASTNode location) { soot.jimple.EnterMonitorStmt stmt = Jimple.v().newEnterMonitorStmt(op); soot.tagkit.Tag tag = getTag(op); if(tag != null) stmt.getOpBox().addTag(tag); return stmt; }
public soot.jimple.IfStmt newIfStmt(Value op, Unit target, ASTNode location) { soot.jimple.IfStmt stmt = Jimple.v().newIfStmt(op, target); soot.tagkit.Tag tag = getTag(op); if(tag != null) stmt.getConditionBox().addTag(tag); return stmt; }
public soot.jimple.InstanceFieldRef newInstanceFieldRef(Value base, SootFieldRef f, ASTNode location) { soot.jimple.InstanceFieldRef ref = Jimple.v().newInstanceFieldRef(base, f); createTag(ref, location); soot.tagkit.Tag tag = getTag(base); if(tag != null) ref.getBaseBox().addTag(tag); return ref; }
public soot.jimple.AssignStmt newAssignStmt(Value variable, Value rvalue, ASTNode location) { soot.jimple.AssignStmt stmt = Jimple.v().newAssignStmt(variable, rvalue); soot.tagkit.Tag left = getTag(variable); if(left != null) stmt.getLeftOpBox().addTag(left); soot.tagkit.Tag right = getTag(rvalue); if(right != null) stmt.getRightOpBox().addTag(right); return stmt; }