system.findOrCreateIndexForInstanceKey(functionKey); ScopeMappingInstanceKey K = (ScopeMappingInstanceKey) functionKey; Iterator<CGNode> x = K.getFunargNodes(definer); while (x.hasNext()) { result.add(x.next()); if (iKey instanceof ScopeMappingInstanceKey) { ScopeMappingInstanceKey K = (ScopeMappingInstanceKey) iKey; Iterator<CGNode> x = K.getFunargNodes(definer); while (x.hasNext()) { result.add(x.next());
system.findOrCreateIndexForInstanceKey(functionKey); ScopeMappingInstanceKey K = (ScopeMappingInstanceKey) functionKey; Iterator<CGNode> x = K.getFunargNodes(definer); while (x.hasNext()) { result.add(x.next()); if (iKey instanceof ScopeMappingInstanceKey) { ScopeMappingInstanceKey K = (ScopeMappingInstanceKey) iKey; Iterator<CGNode> x = K.getFunargNodes(definer); while (x.hasNext()) { result.add(x.next());
private Collection<Pair<CGNode, String>> getNodeNamePairsForAccess(CGNode n, Pair<String, String> nameAndDefiner) { Collection<Pair<CGNode, String>> result = HashSetFactory.make(); // use scope-mapping instance keys in pointer analysis. may need a different // scheme for CG construction not based on pointer analysis OrdinalSet<InstanceKey> functionValues = pa.getPointsToSet(pa.getHeapModel().getPointerKeyForLocal(n, 1)); for (InstanceKey ik : functionValues) { if (ik instanceof ScopeMappingInstanceKey) { ScopeMappingInstanceKey smik = (ScopeMappingInstanceKey) ik; for (CGNode definerNode : Iterator2Iterable.make(smik.getFunargNodes(nameAndDefiner))) { result.add(Pair.make(definerNode, nameAndDefiner.fst)); } } } return result; } }
/** * get the CGNode representing the lexical parent of {@link #creator} with * name definer * */ public Iterator<CGNode> getFunargNodes(Pair<String, String> name) { Collection<CGNode> constructorCallers = getConstructorCallers(this, name); assert constructorCallers != null && !constructorCallers.isEmpty() : "no callers for constructor"; Iterator<CGNode> result = EmptyIterator.instance(); for (CGNode callerOfConstructor : constructorCallers) { if (callerOfConstructor.getMethod().getReference().getDeclaringClass().getName().toString().equals(name.snd)) { result = new CompoundIterator<>(result, new NonNullSingletonIterator<>(callerOfConstructor)); } else { PointerKey funcKey = builder.getPointerKeyForLocal(callerOfConstructor, 1); for (InstanceKey funcPtr : builder.getPointerAnalysis().getPointsToSet(funcKey)) { if (funcPtr instanceof ScopeMappingInstanceKey) { result = new CompoundIterator<>(result, ((ScopeMappingInstanceKey) funcPtr).getFunargNodes(name)); } } } } return result; }
/** * get the CGNode representing the lexical parent of {@link #creator} with * name definer * */ public Iterator<CGNode> getFunargNodes(Pair<String, String> name) { Collection<CGNode> constructorCallers = getConstructorCallers(this, name); assert constructorCallers != null && !constructorCallers.isEmpty() : "no callers for constructor"; Iterator<CGNode> result = EmptyIterator.instance(); for (CGNode callerOfConstructor : constructorCallers) { if (callerOfConstructor.getMethod().getReference().getDeclaringClass().getName().toString().equals(name.snd)) { result = new CompoundIterator<>(result, new NonNullSingletonIterator<>(callerOfConstructor)); } else { PointerKey funcKey = builder.getPointerKeyForLocal(callerOfConstructor, 1); for (InstanceKey funcPtr : builder.getPointerAnalysis().getPointsToSet(funcKey)) { if (funcPtr instanceof ScopeMappingInstanceKey) { result = new CompoundIterator<>(result, ((ScopeMappingInstanceKey) funcPtr).getFunargNodes(name)); } } } } return result; }
private Collection<Pair<CGNode, String>> getNodeNamePairsForAccess(CGNode n, Pair<String, String> nameAndDefiner) { Collection<Pair<CGNode, String>> result = HashSetFactory.make(); // use scope-mapping instance keys in pointer analysis. may need a different // scheme for CG construction not based on pointer analysis OrdinalSet<InstanceKey> functionValues = pa.getPointsToSet(pa.getHeapModel().getPointerKeyForLocal(n, 1)); for (InstanceKey ik : functionValues) { if (ik instanceof ScopeMappingInstanceKey) { ScopeMappingInstanceKey smik = (ScopeMappingInstanceKey) ik; for (CGNode definerNode : Iterator2Iterable.make(smik.getFunargNodes(nameAndDefiner))) { result.add(Pair.make(definerNode, nameAndDefiner.fst)); } } } return result; } }