public void setInterference(Local l1, Local l2) { // We need the mapping in both directions // l1 -> l2 Set<Local> locals = localToLocals.get(l1); if (locals == null) { locals = new ArraySet<Local>(); localToLocals.put(l1, locals); } locals.add(l2); // l2 -> l1 locals = localToLocals.get(l2); if (locals == null) { locals = new ArraySet<Local>(); localToLocals.put(l2, locals); } locals.add(l1); }
/** * Returns a list of possible targets for the given method and set of receiver types. */ public List<SootMethod> resolveAbstractDispatch(List<SootClass> classes, SootMethod m) { m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); Set<SootMethod> s = new ArraySet<SootMethod>(); for (SootClass sootClass : classes) { s.addAll(resolveAbstractDispatch(sootClass, m)); } return Collections.unmodifiableList(new ArrayList<SootMethod>(s)); }
/** Returns a list of implementers of c, excluding itself. */ public List<SootClass> getImplementersOf(SootClass i) { i.checkLevel(SootClass.HIERARCHY); if (!i.isInterface()) { throw new RuntimeException("interface needed; got " + i); } checkState(); ArraySet<SootClass> set = new ArraySet<SootClass>(); for (SootClass c : getSubinterfacesOfIncluding(i)) { set.addAll(getDirectImplementersOf(c)); } ArrayList<SootClass> l = new ArrayList<SootClass>(); l.addAll(set); return Collections.unmodifiableList(l); }
/** * Given a set of definite receiver types, returns a list of possible targets. */ public List<SootMethod> resolveConcreteDispatch(List<Type> classes, SootMethod m) { m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); checkState(); Set<SootMethod> s = new ArraySet<SootMethod>(); for (Type cls : classes) { if (cls instanceof RefType) { s.add(resolveConcreteDispatch(((RefType) cls).getSootClass(), m)); } else if (cls instanceof ArrayType) { s.add(resolveConcreteDispatch((RefType.v("java.lang.Object")).getSootClass(), m)); } else { throw new RuntimeException("Unable to resolve concrete dispatch of type " + cls); } } return Collections.unmodifiableList(new ArrayList<SootMethod>(s)); }
Set<SootClass> s = new ArraySet<SootClass>(); for (SootClass c0 : imp) { if (c.resolvingLevel() < SootClass.HIERARCHY) {
/** * Given an abstract dispatch to an object of type c and a method m, gives a list of possible receiver methods. */ public List<SootMethod> resolveAbstractDispatch(SootClass c, SootMethod m) { c.checkLevel(SootClass.HIERARCHY); m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); checkState(); Set<SootMethod> s = new ArraySet<SootMethod>(); Collection<SootClass> classesIt; if (c.isInterface()) { Set<SootClass> classes = new HashSet<SootClass>(); for (SootClass sootClass : getImplementersOf(c)) { classes.addAll(getSubclassesOfIncluding(sootClass)); } classesIt = classes; } else { classesIt = getSubclassesOfIncluding(c); } for (SootClass cl : classesIt) { if (!Modifier.isAbstract(cl.getModifiers())) { s.add(resolveConcreteDispatch(cl, m)); } } return Collections.unmodifiableList(new ArrayList<SootMethod>(s)); }
Set<Instruction> handlerInstructions = new ArraySet<Instruction>();
Map<Unit, Collection<ExceptionDest>> unitToExceptionDests, Map<Unit, List<Unit>> unitToSuccs, Map<Unit, List<Unit>> unitToPreds, boolean omitExceptingUnitEdges) { Set<Unit> trapsThatAreHeads = new ArraySet<Unit>(); Unit entryPoint = unitChain.getFirst(); for (Entry<Unit, Collection<ExceptionDest>> entry : unitToExceptionDests.entrySet()) {
Set<Unit> handlerUnits = new ArraySet<Unit>(body.getTraps().size());
Set<Local> initialLocals = new ArraySet<Local>();
/** Returns a list of possible targets for the given method and set of receiver types. */ public List resolveAbstractDispatch(List classes, SootMethod m) { m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); ArraySet s = new ArraySet(); Iterator classesIt = classes.iterator(); while (classesIt.hasNext()) s.addAll(resolveAbstractDispatch((SootClass)classesIt.next(), m)); List l = new ArrayList(); l.addAll(s); return Collections.unmodifiableList(l); }
/** Returns a list of possible targets for the given method and set of receiver types. */ public List resolveAbstractDispatch(List classes, SootMethod m) { m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); ArraySet s = new ArraySet(); Iterator classesIt = classes.iterator(); while (classesIt.hasNext()) s.addAll(resolveAbstractDispatch((SootClass)classesIt.next(), m)); List l = new ArrayList(); l.addAll(s); return Collections.unmodifiableList(l); }
/** Returns a list of implementers of c, excluding itself. */ public List<SootClass> getImplementersOf(SootClass i) { i.checkLevel(SootClass.HIERARCHY); if (!i.isInterface()) throw new RuntimeException("interface needed; got "+i); checkState(); Iterator<SootClass> it = getSubinterfacesOfIncluding(i).iterator(); ArraySet set = new ArraySet(); while (it.hasNext()) { SootClass c = it.next(); set.addAll(getDirectImplementersOf(c)); } ArrayList l = new ArrayList(); l.addAll(set); return Collections.unmodifiableList(l); }
/** Returns a list of implementers of c, excluding itself. */ public List<SootClass> getImplementersOf(SootClass i) { i.checkLevel(SootClass.HIERARCHY); if (!i.isInterface()) throw new RuntimeException("interface needed; got "+i); checkState(); Iterator<SootClass> it = getSubinterfacesOfIncluding(i).iterator(); ArraySet set = new ArraySet(); while (it.hasNext()) { SootClass c = it.next(); set.addAll(getDirectImplementersOf(c)); } ArrayList l = new ArrayList(); l.addAll(set); return Collections.unmodifiableList(l); }
/** Given an abstract dispatch to an object of type c and a method m, gives * a list of possible receiver methods. */ public List resolveAbstractDispatch(SootClass c, SootMethod m) { c.checkLevel(SootClass.HIERARCHY); m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); checkState(); Iterator<SootClass> classesIt = null; if (c.isInterface()) { classesIt = getImplementersOf(c).iterator(); HashSet<SootClass> classes = new HashSet<SootClass>(); while (classesIt.hasNext()) classes.addAll(getSubclassesOfIncluding(classesIt.next())); classesIt = classes.iterator(); } else classesIt = getSubclassesOfIncluding(c).iterator(); ArraySet s = new ArraySet(); while (classesIt.hasNext()) { SootClass cl = classesIt.next(); if( Modifier.isAbstract( cl.getModifiers() ) ) continue; s.add(resolveConcreteDispatch(cl, m)); } List l = new ArrayList(); l.addAll(s); return Collections.unmodifiableList(l); }
/** Given a set of definite receiver types, returns a list of possible targets. */ public List resolveConcreteDispatch(List classes, SootMethod m) { m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); checkState(); ArraySet s = new ArraySet(); Iterator classesIt = classes.iterator(); while (classesIt.hasNext()) { Object cls = classesIt.next(); if (cls instanceof RefType) s.add(resolveConcreteDispatch(((RefType)cls).getSootClass(), m)); else if (cls instanceof ArrayType) { s.add(resolveConcreteDispatch((RefType.v("java.lang.Object")).getSootClass(), m)); } else throw new RuntimeException("Unable to resolve concrete dispatch of type "+ cls); } List l = new ArrayList(); l.addAll(s); return Collections.unmodifiableList(l); }
localToLocals.put(local, new ArraySet());
/** Given a set of definite receiver types, returns a list of possible targets. */ public List resolveConcreteDispatch(List classes, SootMethod m) { m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); checkState(); ArraySet s = new ArraySet(); Iterator classesIt = classes.iterator(); while (classesIt.hasNext()) { Object cls = classesIt.next(); if (cls instanceof RefType) s.add(resolveConcreteDispatch(((RefType)cls).getSootClass(), m)); else if (cls instanceof ArrayType) { s.add(resolveConcreteDispatch((RefType.v("java.lang.Object")).getSootClass(), m)); } else throw new RuntimeException("Unable to resolve concrete dispatch of type "+ cls); } List l = new ArrayList(); l.addAll(s); return Collections.unmodifiableList(l); }
/** Given an abstract dispatch to an object of type c and a method m, gives * a list of possible receiver methods. */ public List resolveAbstractDispatch(SootClass c, SootMethod m) { c.checkLevel(SootClass.HIERARCHY); m.getDeclaringClass().checkLevel(SootClass.HIERARCHY); checkState(); Iterator<SootClass> classesIt = null; if (c.isInterface()) { classesIt = getImplementersOf(c).iterator(); HashSet<SootClass> classes = new HashSet<SootClass>(); while (classesIt.hasNext()) classes.addAll(getSubclassesOfIncluding(classesIt.next())); classesIt = classes.iterator(); } else classesIt = getSubclassesOfIncluding(c).iterator(); ArraySet s = new ArraySet(); while (classesIt.hasNext()) { SootClass cl = classesIt.next(); if( Modifier.isAbstract( cl.getModifiers() ) ) continue; s.add(resolveConcreteDispatch(cl, m)); } List l = new ArrayList(); l.addAll(s); return Collections.unmodifiableList(l); }
localToLocals.put(local, new ArraySet());