/** * visit each normal (non-phi, non-pi, non-catch) instruction in this IR */ public void visitNormalInstructions(SSAInstruction.IVisitor v) { for (SSAInstruction inst : Iterator2Iterable.make(iterateNormalInstructions())) { inst.visit(v); } }
/** * visit each normal (non-phi, non-pi, non-catch) instruction in this IR */ public void visitNormalInstructions(SSAInstruction.IVisitor v) { for (SSAInstruction inst : Iterator2Iterable.make(iterateNormalInstructions())) { inst.visit(v); } }
for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof SSAGetInstruction) { SSAGetInstruction get = (SSAGetInstruction) instr;
for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof SSAGetInstruction) { SSAGetInstruction get = (SSAGetInstruction) instr;
for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof SSAGetInstruction) { SSAGetInstruction get = (SSAGetInstruction) instr;
for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof SSAGetInstruction) { SSAGetInstruction get = (SSAGetInstruction) instr;
public Iterator<FieldReference> iterateFields(CGNode node, Predicate<SSAInstruction> filter) { return new MapIterator<>( new FilterIterator<>(getIR(node).iterateNormalInstructions(), filter), object -> ((SSAFieldAccessInstruction)object).getDeclaredField()); }
protected Collection<Pair<CGNode, String>> scanNodeForLexWrites(CGNode n) { Collection<Pair<CGNode, String>> result = HashSetFactory.make(); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof AstLexicalWrite) { AstLexicalWrite write = (AstLexicalWrite) instr; for (Access a : write.getAccesses()) { Pair<String, String> nameAndDefiner = a.getName(); result.addAll(getNodeNamePairsForAccess(n, nameAndDefiner)); } } } } return result; }
public Iterator<FieldReference> iterateFields(CGNode node, Predicate<SSAInstruction> filter) { return new MapIterator<>( new FilterIterator<>(getIR(node).iterateNormalInstructions(), filter), object -> ((SSAFieldAccessInstruction)object).getDeclaredField()); }
protected Collection<Pair<CGNode, String>> scanNodeForLexReads(CGNode n) { Collection<Pair<CGNode, String>> result = HashSetFactory.make(); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof AstLexicalRead) { AstLexicalRead read = (AstLexicalRead) instr; for (Access a : read.getAccesses()) { Pair<String, String> nameAndDefiner = a.getName(); result.addAll(getNodeNamePairsForAccess(n, nameAndDefiner)); } } } } return result; }
protected Collection<Pair<CGNode, String>> scanNodeForLexReads(CGNode n) { Collection<Pair<CGNode, String>> result = HashSetFactory.make(); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof AstLexicalRead) { AstLexicalRead read = (AstLexicalRead) instr; for (Access a : read.getAccesses()) { Pair<String, String> nameAndDefiner = a.getName(); result.addAll(getNodeNamePairsForAccess(n, nameAndDefiner)); } } } } return result; }
protected Collection<Pair<CGNode, String>> scanNodeForLexWrites(CGNode n) { Collection<Pair<CGNode, String>> result = HashSetFactory.make(); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction instr : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (instr instanceof AstLexicalWrite) { AstLexicalWrite write = (AstLexicalWrite) instr; for (Access a : write.getAccesses()) { Pair<String, String> nameAndDefiner = a.getName(); result.addAll(getNodeNamePairsForAccess(n, nameAndDefiner)); } } } } return result; }
/** * For a call graph node, what heap locations (as determined by a heap model) may it read, <b> NOT </b> including it's callees * transitively */ private Collection<PointerKey> scanNodeForRef(final CGNode n, final PointerAnalysis<T> pa, HeapExclusions heapExclude) { Collection<PointerKey> result = HashSetFactory.make(); final ExtendedHeapModel h = makeHeapModel(pa); SSAInstruction.Visitor v = makeRefVisitor(n, result, pa, h); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction x : Iterator2Iterable.make(ir.iterateNormalInstructions())) { x.visit(v); assert ! result.contains(null) : x; } } if (heapExclude != null) { result = heapExclude.filter(result); } return result; }
/** * For a call graph node, what heap locations (as determined by a heap model) may it write, <b> NOT </b> including it's callees * transitively */ private Collection<PointerKey> scanNodeForMod(final CGNode n, final PointerAnalysis<T> pa, HeapExclusions heapExclude) { Collection<PointerKey> result = HashSetFactory.make(); final ExtendedHeapModel h = makeHeapModel(pa); SSAInstruction.Visitor v = makeModVisitor(n, result, pa, h); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction inst : Iterator2Iterable.make(ir.iterateNormalInstructions())) { inst.visit(v); assert ! result.contains(null); } } if (heapExclude != null) { result = heapExclude.filter(result); } return result; }
/** * For a call graph node, what heap locations (as determined by a heap model) may it read, <b> NOT </b> including it's callees * transitively */ private Collection<PointerKey> scanNodeForRef(final CGNode n, final PointerAnalysis<T> pa, HeapExclusions heapExclude) { Collection<PointerKey> result = HashSetFactory.make(); final ExtendedHeapModel h = makeHeapModel(pa); SSAInstruction.Visitor v = makeRefVisitor(n, result, pa, h); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction x : Iterator2Iterable.make(ir.iterateNormalInstructions())) { x.visit(v); assert ! result.contains(null) : x; } } if (heapExclude != null) { result = heapExclude.filter(result); } return result; }
/** * For a call graph node, what heap locations (as determined by a heap model) may it write, <b> NOT </b> including it's callees * transitively */ private Collection<PointerKey> scanNodeForMod(final CGNode n, final PointerAnalysis<T> pa, HeapExclusions heapExclude) { Collection<PointerKey> result = HashSetFactory.make(); final ExtendedHeapModel h = makeHeapModel(pa); SSAInstruction.Visitor v = makeModVisitor(n, result, pa, h); IR ir = n.getIR(); if (ir != null) { for (SSAInstruction inst : Iterator2Iterable.make(ir.iterateNormalInstructions())) { inst.visit(v); assert ! result.contains(null); } } if (heapExclude != null) { result = heapExclude.filter(result); } return result; }
/** * @return an {@link Iterator} of all instructions (Normal, Phi, and Catch) */ public Iterator<SSAInstruction> iterateAllInstructions() { return new CompoundIterator<>(iterateNormalInstructions(), new CompoundIterator<>( iterateCatchInstructions(), new CompoundIterator<>(iteratePhis(), iteratePis()))); }
/** * @return an {@link Iterator} of all instructions (Normal, Phi, and Catch) */ public Iterator<SSAInstruction> iterateAllInstructions() { return new CompoundIterator<>(iterateNormalInstructions(), new CompoundIterator<>( iterateCatchInstructions(), new CompoundIterator<>(iteratePhis(), iteratePis()))); }
for (SSAInstruction s : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (s instanceof SSAAbstractInvokeInstruction) { SSAAbstractInvokeInstruction call = (SSAAbstractInvokeInstruction) s;
for (SSAInstruction s : Iterator2Iterable.make(ir.iterateNormalInstructions())) { if (s instanceof SSAAbstractInvokeInstruction) { SSAAbstractInvokeInstruction call = (SSAAbstractInvokeInstruction) s;