/** * 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; // Make sure that we have a hierarchy Scene.v().getOrMakeFastHierarchy(); }
public static boolean ancestor_(Type ancestor, Type child) { if (TypeResolver.typesEqual(ancestor, child)) { return true; } else if (child instanceof BottomType) { return true; } else if (ancestor instanceof BottomType) { return false; } else if (ancestor instanceof IntegerType && child instanceof IntegerType) { return true; } else if (ancestor instanceof PrimType || child instanceof PrimType) { return false; } else if (child instanceof NullType) { return true; } else if (ancestor instanceof NullType) { return false; } else { return Scene.v().getOrMakeFastHierarchy().canStoreType(child, ancestor); } }
protected void resolveAnySubType(Type declaredType, Type sigType, NumberedString subSig, SootMethod container, ChunkedQueue<SootMethod> targets, boolean appOnly, RefType base) { FastHierarchy fastHierachy = Scene.v().getOrMakeFastHierarchy();
Set<RefLikeType> resultSet = new HashSet<>(this.exceptionsIncluded); int changes = 0; FastHierarchy hierarchy = Scene.v().getOrMakeFastHierarchy();
FastHierarchy hierarchy = Scene.v().getOrMakeFastHierarchy();
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 void resolveLibrarySignature(Type declaredType, Type sigType, NumberedString subSig, SootMethod container, ChunkedQueue<SootMethod> targets, boolean appOnly, RefType base) { FastHierarchy fastHierachy = Scene.v().getOrMakeFastHierarchy();
FastHierarchy h = Scene.v().getOrMakeFastHierarchy();
public OnFlyCallGraphBuilder(ContextManager cm, ReachableMethods rm) { this.cm = cm; this.rm = rm; worklist = rm.listener(); options = new CGOptions(PhaseOptions.v().getPhaseOptions("cg")); if (!options.verbose()) { logger.debug("" + "[Call Graph] For information on where the call graph may be incomplete," + "use the verbose option to the cg phase."); } if (options.reflection_log() == null || options.reflection_log().length() == 0) { if (options.types_for_invoke() && new SparkOptions(PhaseOptions.v().getPhaseOptions("cg.spark")).enabled()) { reflectionModel = new TypeBasedReflectionModel(); } else { reflectionModel = new DefaultReflectionModel(); } } else { reflectionModel = new TraceBasedReflectionModel(); } this.fh = Scene.v().getOrMakeFastHierarchy(); }
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; } }
public void caseCastExpr(CastExpr expr) { result = result.add(mgr.RESOLVE_CLASS_ERRORS); Type fromType = expr.getOp().getType(); Type toType = expr.getCastType(); if (toType instanceof RefLikeType) { // fromType might still be unknown when we are called, // but toType will have a value. FastHierarchy h = Scene.v().getOrMakeFastHierarchy(); if (fromType == null || fromType instanceof UnknownType || ((!(fromType instanceof NullType)) && (!h.canStoreType(fromType, toType)))) { result = result.add(mgr.CLASS_CAST_EXCEPTION); } } result = result.add(mightThrow(expr.getOp())); }
@Override public void caseCastExpr(CastExpr expr) { if (expr.getCastType() instanceof PrimType) { // No exception are thrown for primitive casts return; } Type fromType = expr.getOp().getType(); Type toType = expr.getCastType(); result = result.add(mgr.RESOLVE_CLASS_ERRORS); if (toType instanceof RefLikeType) { // fromType might still be unknown when we are called, // but toType will have a value. FastHierarchy h = Scene.v().getOrMakeFastHierarchy(); if (fromType == null || fromType instanceof UnknownType || ((!(fromType instanceof NullType)) && (!h.canStoreType(fromType, toType)))) { result = result.add(mgr.CLASS_CAST_EXCEPTION); } } result = result.add(mightThrow(expr.getOp())); } };
FastHierarchy fastHierachy = Scene.v().getOrMakeFastHierarchy(); if (fastHierachy.canStoreClass(childClass,parentClass)) { SootMethod target = resolveNonSpecial(child, subSig, appOnly);
FastHierarchy hierarchy = Scene.v().getOrMakeFastHierarchy(); boolean eHasNoHierarchy = hasNoHierarchy(e);
FastHierarchy hierarchy = Scene.v().getOrMakeFastHierarchy(); RefType newBase = e.getBase(); boolean newBaseHasNoHierarchy = hasNoHierarchy(newBase);
t = RefType.v("java.lang.Object"); FastHierarchy fastHierachy = Scene.v().getOrMakeFastHierarchy(); if (declaredType != null && !fastHierachy.canStoreType(t, declaredType)) { return;
typeManager.setFastHierarchy(() -> Scene.v().getOrMakeFastHierarchy());
if (Scene.v().getOrMakeFastHierarchy().canStoreClass(currentClass, calledClass)) { return Jimple.v().newSpecialInvokeExpr(args.get(0), methodRef, rest(args)); } else {
public void addType(Local receiver, Context srcContext, Type type, Context typeContext) { FastHierarchy fh = Scene.v().getOrMakeFastHierarchy(); if (receiverToSites.get(receiver) != null) { for (Iterator<VirtualCallSite> siteIt = receiverToSites.get(receiver).iterator(); siteIt.hasNext();) {
FastHierarchy h = Scene.v().getOrMakeFastHierarchy(); Set<RefLikeType> caughtIncluded = null; Set<AnySubType> caughtExcluded = null;