/** * Retrieves the active fast hierarchy */ public FastHierarchy getFastHierarchy() { if (!hasFastHierarchy()) { throw new RuntimeException("no active FastHierarchy present for scene"); } return activeFastHierarchy; }
/** * Makes a new fast hierarchy is none is active, and returns the active fast hierarchy. */ public FastHierarchy getOrMakeFastHierarchy() { if (!hasFastHierarchy()) { setFastHierarchy(new FastHierarchy()); } return getFastHierarchy(); }
private synchronized void ensureClassHasBodies(SootClass cl) { assert Scene.v().hasFastHierarchy(); if (cl.resolvingLevel() < SootClass.BODIES) { Scene.v().forceResolve(cl.getName(), SootClass.BODIES); Scene.v().getOrMakeFastHierarchy(); } assert Scene.v().hasFastHierarchy(); }
protected Body initForMethod(SootMethod m) { assert Scene.v().hasFastHierarchy(); Body b = null; if (m.isConcrete()) { SootClass declaringClass = m.getDeclaringClass(); ensureClassHasBodies(declaringClass); synchronized (Scene.v()) { b = m.retrieveActiveBody(); } if (b != null) { for (Unit u : b.getUnits()) { if (unitToOwner.put(u, b) != null) { // if the unit was registered already then so were all units; // simply skip the rest break; } } } } assert Scene.v().hasFastHierarchy(); return b; }
/** Retrieves the active fast hierarchy */ public FastHierarchy getFastHierarchy() { if(!hasFastHierarchy()) throw new RuntimeException("no active FastHierarchy present for scene"); return activeFastHierarchy; }
/** Retrieves the active fast hierarchy */ public FastHierarchy getFastHierarchy() { if(!hasFastHierarchy()) throw new RuntimeException("no active FastHierarchy present for scene"); return activeFastHierarchy; }
/** Constructs a new empty set given a list of all locals and types that may * ever be in the set. */ public LocalTypeSet( List<Local> locals, List<Type> types ) { super( locals.size() * types.size() ); this.locals = locals; this.types = types; if( !Scene.v().hasFastHierarchy() ) { Scene.v().setFastHierarchy( new FastHierarchy() ); } } /** Returns the number of the bit corresponding to the pair (l,t). */
/** Constructs a new empty set given a list of all locals and types that may * ever be in the set. */ public LocalTypeSet( List<Local> locals, List<Type> types ) { super( locals.size() * types.size() ); this.locals = locals; this.types = types; if( !Scene.v().hasFastHierarchy() ) { Scene.v().setFastHierarchy( new FastHierarchy() ); } } /** Returns the number of the bit corresponding to the pair (l,t). */
/** Makes a new fast hierarchy is none is active, and returns the active * fast hierarchy. */ public FastHierarchy getOrMakeFastHierarchy() { if(!hasFastHierarchy() ) { setFastHierarchy( new FastHierarchy() ); } return getFastHierarchy(); } /**
/** Makes a new fast hierarchy is none is active, and returns the active * fast hierarchy. */ public FastHierarchy getOrMakeFastHierarchy() { if(!hasFastHierarchy() ) { setFastHierarchy( new FastHierarchy() ); } return getFastHierarchy(); } /**
@Override public IInfoflowCFG buildBiDirICFG(CallgraphAlgorithm callgraphAlgorithm, boolean enableExceptions) { if (callgraphAlgorithm == CallgraphAlgorithm.OnDemand) { // Load all classes on the classpath to signatures long beforeClassLoading = System.nanoTime(); OnTheFlyJimpleBasedICFG.loadAllClassesOnClassPathToSignatures(); logger.info("Class loading took {} seconds", (System.nanoTime() - beforeClassLoading) / 1E9); long beforeHierarchy = System.nanoTime(); Scene.v().getOrMakeFastHierarchy(); assert Scene.v().hasFastHierarchy(); logger.info("Hierarchy building took {} seconds", (System.nanoTime() - beforeHierarchy) / 1E9); long beforeCFG = System.nanoTime(); IInfoflowCFG cfg = new InfoflowCFG(new OnTheFlyJimpleBasedICFG(Scene.v().getEntryPoints())); logger.info("CFG generation took {} seconds", (System.nanoTime() - beforeCFG) / 1E9); return cfg; } BiDiInterproceduralCFG<Unit, SootMethod> baseCFG = getBaseCFG(enableExceptions); return new InfoflowCFG(baseCFG); }
private void getMethodsForSeedsIncremental(SootMethod sm, Set<SootMethod> doneSet, List<SootMethod> seeds, IInfoflowCFG icfg) { assert Scene.v().hasFastHierarchy(); if (!sm.isConcrete() || !sm.getDeclaringClass().isApplicationClass() || !doneSet.add(sm)) return; seeds.add(sm); for (Unit u : sm.retrieveActiveBody().getUnits()) { Stmt stmt = (Stmt) u; if (stmt.containsInvokeExpr()) for (SootMethod callee : icfg.getCalleesOfCallAt(stmt)) if (isValidSeedMethod(callee)) getMethodsForSeedsIncremental(callee, doneSet, seeds, icfg); } }