/** * @ast method * @aspect EmitJimple * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/EmitJimple.jrag:46 */ private Type refined_EmitJimple_TypeDecl_getSootType() { return getSootClassDecl().getType(); }
private Collection<Type> getTransitiveSubClasses(Set<SootClass> classRoots) { LinkedList<SootClass> worklist = new LinkedList<>(classRoots); Set<Type> resolved = new HashSet<>(); while (!worklist.isEmpty()) { SootClass cls = worklist.removeFirst(); if (!resolved.add(cls.getType())) { continue; } worklist.addAll(fh.getSubclassesOf(cls)); } return resolved; }
public boolean validateMatchesForField(SparkField field) { if (field instanceof ArrayElement) { return true; } SootField sootField = (SootField) field; String fieldTypeStr = sootField.getDeclaringClass().getType().toString(); for (String typeName : importantTypes) { if (fieldTypeStr.equals(typeName)) { return true; } } return false; }
public boolean validFromBothEnds(SparkField field) { if (field instanceof SootField) { SootField sootField = (SootField) field; RefType declaringType = sootField.getDeclaringClass().getType(); for (RefType type : notBothEndsTypes) { if (manager.castNeverFails(declaringType, type)) { return false; } } } return true; }
private static RefType isHandlerUnit(Chain<Trap> traps, Unit h) { Iterator<Trap> it = traps.iterator(); while (it.hasNext()) { Trap t = (Trap) it.next(); if (t.getHandlerUnit() == h) { return t.getException().getType(); } } return null; }
/** Get type variable for the given soot class. **/ public TypeVariableBV typeVariable(SootClass sootClass) { return typeVariable(hierarchy.typeNode(sootClass.getType())); }
/** Get type variable for the given soot class. **/ public TypeVariable typeVariable(SootClass sootClass) { return typeVariable(hierarchy.typeNode(sootClass.getType())); }
public SootMethod resolveSpecial(SpecialInvokeExpr iie, NumberedString subSig, SootMethod container, boolean appOnly) { SootMethod target = iie.getMethod(); /* cf. JVM spec, invokespecial instruction */ if (Scene.v().getOrMakeFastHierarchy().canStoreType(container.getDeclaringClass().getType(), target.getDeclaringClass().getType()) && container.getDeclaringClass().getType() != target.getDeclaringClass().getType() && !target.getName().equals("<init>") && subSig != sigClinit) { return resolveNonSpecial(container.getDeclaringClass().getSuperclass().getType(), subSig, appOnly); } else { return target; } }
final public Node caseThis() { VarNode ret = pag.makeLocalVarNode(new Pair<SootMethod, String>(method, PointsToAnalysis.THIS_NODE), method.getDeclaringClass().getType(), method); ret.setInterProcTarget(); return ret; }
public void toString(UnitPrinter up) { up.type(methodRef.declaringClass().getType()); up.literal("."); super.toString(up); }
public void toString(UnitPrinter up) { if (!supressDeclaringClass) { up.type(fieldRef.declaringClass().getType()); up.literal("."); } up.fieldRef(fieldRef); }
public void caseFieldGetInst(FieldGetInst i) { remove_types = new Type[] { i.getField().getDeclaringClass().getType() }; add_types = new Type[] { i.getField().getType() }; }
public void caseFieldPutInst(FieldPutInst i) { remove_types = new Type[] { i.getField().getDeclaringClass().getType(), i.getField().getType() }; add_types = null; }
public static EquivalentValue getNodeForThisRef(SootMethod sm) { return new CachedEquivalentValue(new ThisRef(sm.getDeclaringClass().getType())); }
private void handleInstanceFieldRef(InstanceFieldRef ifr, Stmt stmt) { ifr.setBase(this.uv.visit(ifr.getBase(), ifr.getFieldRef().declaringClass().getType(), stmt)); }
final public Node caseNewInstance(VarNode cls) { if (cls instanceof ContextVarNode) { cls = pag.findLocalVarNode(cls.getVariable()); } VarNode local = pag.makeGlobalVarNode(cls, rtObject); for (SootClass cl : Scene.v().dynamicClasses()) { AllocNode site = pag.makeAllocNode(new Pair<VarNode, SootClass>(cls, cl), cl.getType(), null); pag.addEdge(site, local); } return local; }
private soot.SootMethod makeLiFieldAccessMethod(soot.SootClass classToInvoke, polyglot.types.LocalInstance li) { String name = "access$" + soot.javaToJimple.InitialResolver.v().getNextPrivateAccessCounter() + "00"; ArrayList paramTypes = new ArrayList(); paramTypes.add(classToInvoke.getType()); soot.SootMethod meth = Scene.v().makeSootMethod(name, paramTypes, Util.getSootType(li.type()), soot.Modifier.STATIC); classToInvoke.addMethod(meth); PrivateFieldAccMethodSource src = new PrivateFieldAccMethodSource(Util.getSootType(li.type()), "val$" + li.name(), false, classToInvoke); meth.setActiveBody(src.getBody(meth, null)); meth.addTag(new soot.tagkit.SyntheticTag()); return meth; }
private static soot.SootMethod makeOuterThisAccessMethod(soot.SootClass classToInvoke) { String name = "access$" + soot.javaToJimple.InitialResolver.v().getNextPrivateAccessCounter() + "00"; ArrayList paramTypes = new ArrayList(); paramTypes.add(classToInvoke.getType()); soot.SootMethod meth = Scene.v().makeSootMethod(name, paramTypes, classToInvoke.getFieldByName("this$0").getType(), soot.Modifier.STATIC); classToInvoke.addMethod(meth); PrivateFieldAccMethodSource src = new PrivateFieldAccMethodSource(classToInvoke.getFieldByName("this$0").getType(), "this$0", classToInvoke.getFieldByName("this$0").isStatic(), classToInvoke); meth.setActiveBody(src.getBody(meth, null)); meth.addTag(new soot.tagkit.SyntheticTag()); return meth; }
private void handleInvokeExpr(InvokeExpr ie, Stmt stmt) { SootMethodRef m = ie.getMethodRef(); if (ie instanceof InstanceInvokeExpr) { InstanceInvokeExpr iie = (InstanceInvokeExpr) ie; iie.setBase(this.uv.visit(iie.getBase(), m.declaringClass().getType(), stmt)); } for (int i = 0; i < ie.getArgCount(); i++) { ie.setArg(i, this.uv.visit(ie.getArg(i), m.parameterType(i), stmt)); } }
@Override protected void internalTransform(Body b, String phaseName, Map<String, String> options) { for (Trap t : b.getTraps()) { // If the first statement already catches the exception, we're fine if (isCaughtExceptionRef(t.getHandlerUnit())) { continue; } // Add the exception reference Local l = new LocalGenerator(b).generateLocal(t.getException().getType()); Stmt caughtStmt = Jimple.v().newIdentityStmt(l, Jimple.v().newCaughtExceptionRef()); b.getUnits().add(caughtStmt); b.getUnits().add(Jimple.v().newGotoStmt(t.getHandlerUnit())); t.setHandlerUnit(caughtStmt); } }