/** * Constructs a ParameterRef(SootMethod, int) grammar chunk. */ public ParameterRef newParameterRef(Type paramType, int number) { return Jimple.v().newParameterRef(paramType, number); }
public soot.jimple.ParameterRef newParameterRef(Type paramType, int number, ASTNode location) { soot.jimple.ParameterRef ref = Jimple.v().newParameterRef(paramType, number); createTag(ref, location); return ref; }
public void outAIdentityStatement(AIdentityStatement node) { Type identityRefType = (Type) mProductions.removeLast(); String atClause = (String) mProductions.removeLast(); Value local = mLocals.get(mProductions.removeLast()); // the local ref // from it's // identifier Value ref = null; if (atClause.startsWith("@this")) { ref = Jimple.v().newThisRef((RefType) identityRefType); } else if (atClause.startsWith("@parameter")) { int index = Integer.parseInt(atClause.substring(10, atClause.length() - 1)); ref = Jimple.v().newParameterRef(identityRefType, index); } else { throw new RuntimeException("shouldn't @caughtexception be handled by outAIdentityNoTypeStatement: got" + atClause); } Unit u = Jimple.v().newIdentityStmt(local, ref); mProductions.addLast(u); }
public static List<Local> buildParameterLocals(PatchingChain<Unit> units, Collection<Local> locals, List<Type> paramTypes) { List<Local> args = new ArrayList<Local>(); for (int k = 0; k < paramTypes.size(); k++) { Type type = paramTypes.get(k); Local loc = Jimple.v().newLocal("l" + k, type); locals.add(loc); units.add(Jimple.v().newIdentityStmt(loc, Jimple.v().newParameterRef(type, k))); args.add(loc); } return args; }
private void emitLocals() { JimpleBody jb = body; SootMethod m = jb.getMethod(); Collection<Local> jbl = jb.getLocals(); Collection<Unit> jbu = jb.getUnits(); int iloc = 0; if (!m.isStatic()) { Local l = getLocal(iloc++); jbu.add(Jimple.v().newIdentityStmt(l, Jimple.v().newThisRef(m.getDeclaringClass().getType()))); } int nrp = 0; for (Object ot : m.getParameterTypes()) { Type t = (Type) ot; Local l = getLocal(iloc); jbu.add(Jimple.v().newIdentityStmt(l, Jimple.v().newParameterRef(t, nrp++))); if (AsmUtil.isDWord(t)) { iloc += 2; } else { iloc++; } } for (Local l : locals.values()) { jbl.add(l); } }
Local l = lg.generateLocal(type); accStmts.add(Jimple.v().newIdentityStmt(l, Jimple.v().newParameterRef(type, paramID))); arguments.add(l); paramID++;
private void getBootstrapBody(SootClass tclass, JimpleBody jb) { PatchingChain<Unit> us = jb.getUnits(); LocalGenerator lc = new LocalGenerator(jb); List<Value> capValues = new ArrayList<Value>(); List<Type> capTypes = new ArrayList<Type>(); int i = 0; for (SootField capField : capFields) { Type type = capField.getType(); capTypes.add(type); Local p = lc.generateLocal(type); ParameterRef pref = Jimple.v().newParameterRef(type, i); us.add(Jimple.v().newIdentityStmt(p, pref)); capValues.add(p); i++; } Local l = lc.generateLocal(tclass.getType()); Value val = Jimple.v().newNewExpr(tclass.getType()); us.add(Jimple.v().newAssignStmt(l, val)); us.add(Jimple.v() .newInvokeStmt(Jimple.v().newSpecialInvokeExpr(l, Scene.v().makeConstructorRef(tclass, capTypes), capValues))); us.add(Jimple.v().newReturnStmt(l)); }
for (Type ty : implMethodType.getParameterTypes()) { Local l = lc.generateLocal(ty); us.add(Jimple.v().newIdentityStmt(l, Jimple.v().newParameterRef(ty, i))); samParamLocals.add(l); i++;
initialLocals.add(local); units.add(Jimple.v().newIdentityStmt(local, Jimple.v().newParameterRef(type, argCount)));
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; }
/** * Formal creation - method parameters */ private void createFormal(polyglot.ast.Formal formal, int counter) { soot.Type sootType = Util.getSootType(formal.type().type()); soot.Local formalLocal = createLocal(formal.localInstance()); soot.jimple.ParameterRef paramRef = soot.jimple.Jimple.v().newParameterRef(sootType, counter); paramRefCount++; soot.jimple.Stmt stmt = soot.jimple.Jimple.v().newIdentityStmt(formalLocal, paramRef); body.getUnits().add(stmt); Util.addLnPosTags(((soot.jimple.IdentityStmt) stmt).getRightOpBox(), formal.position()); Util.addLnPosTags(stmt, formal.position()); }
soot.Local paramLocal = lg.generateLocal(sootType); soot.jimple.ParameterRef paramRef = soot.jimple.Jimple.v().newParameterRef(sootType, 0); soot.jimple.Stmt stmt = soot.jimple.Jimple.v().newIdentityStmt(paramLocal, paramRef); body.getUnits().add(stmt);
for (Type t : getMethod().getParameterTypes()) { Local l = jimple.newLocal("parameter" + i, t); Stmt s = jimple.newIdentityStmt(l, jimple.newParameterRef(l.getType(), i));
soot.Local paramLocal = lg.generateLocal(sootType); soot.jimple.ParameterRef paramRef = soot.jimple.Jimple.v().newParameterRef(sootType, paramCounter); soot.jimple.Stmt stmt = soot.jimple.Jimple.v().newIdentityStmt(paramLocal, paramRef); body.getUnits().add(stmt);
soot.Local paramLocal = lg.generateLocal(sootType); soot.jimple.ParameterRef paramRef = soot.jimple.Jimple.v().newParameterRef(sootType, paramCounter); soot.jimple.Stmt stmt = soot.jimple.Jimple.v().newIdentityStmt(paramLocal, paramRef); body.getUnits().add(stmt);
int paramID = 0; if (ref instanceof InstanceFieldRef) { accStmts.add(Jimple.v().newIdentityStmt(thisLocal, Jimple.v().newParameterRef(target.getType(), paramID))); parameterTypes.add(target.getType()); paramID++; accStmts.add(Jimple.v().newIdentityStmt(l, Jimple.v().newParameterRef(ref.getField().getType(), paramID))); paramID++; if (ref instanceof InstanceFieldRef) {
if (ref instanceof InstanceFieldRef) { parameterTypes.add(target.getType()); accStmts.addFirst(Jimple.v().newIdentityStmt(thisLocal, Jimple.v().newParameterRef(target.getType(), 0)));
for (SootField f : capFields) { Local l2 = lc.generateLocal(f.getType()); us.add(Jimple.v().newIdentityStmt(l2, Jimple.v().newParameterRef(f.getType(), i))); capLocals.add(l2); i++;
soot.jimple.ParameterRef paramRef = soot.jimple.Jimple.v().newParameterRef(soot.RefType.v("java.lang.String"), 0);
Jimple.v().newInstanceFieldRef(b.emitThis(hostType()), hostType().getSootField("this$0", type).makeRef()), asLocal(b, Jimple.v().newParameterRef(type.getSootType(), 0))));