/** * Collects all exceptions, which could be dispatched by the throw * instruction, using the pointer analysis. Adds the collected exceptions to * addTo. * * @param addTo * set to add the result * @param instruction * the throw instruction */ private void addThrown(LinkedHashSet<TypeReference> addTo, SSAThrowInstruction instruction) { int exceptionVariable = instruction.getException(); if (pointerAnalysis != null) { PointerKey pointerKey = pointerAnalysis.getHeapModel().getPointerKeyForLocal(node, exceptionVariable); Iterator<Object> it = pointerAnalysis.getHeapGraph().getSuccNodes(pointerKey); while (it.hasNext()) { Object next = it.next(); if (next instanceof InstanceKey) { InstanceKey instanceKey = (InstanceKey) next; IClass iclass = instanceKey.getConcreteType(); addTo.add(iclass.getReference()); } else { throw new IllegalStateException("Internal error: Expected InstanceKey, got " + next.getClass().getName()); } } } }
/** * Collects all exceptions, which could be dispatched by the throw * instruction, using the pointer analysis. Adds the collected exceptions to * addTo. * * @param addTo * set to add the result * @param instruction * the throw instruction */ private void addThrown(LinkedHashSet<TypeReference> addTo, SSAThrowInstruction instruction) { int exceptionVariable = instruction.getException(); if (pointerAnalysis != null) { PointerKey pointerKey = pointerAnalysis.getHeapModel().getPointerKeyForLocal(node, exceptionVariable); Iterator<Object> it = pointerAnalysis.getHeapGraph().getSuccNodes(pointerKey); while (it.hasNext()) { Object next = it.next(); if (next instanceof InstanceKey) { InstanceKey instanceKey = (InstanceKey) next; IClass iclass = instanceKey.getConcreteType(); addTo.add(iclass.getReference()); } else { throw new IllegalStateException("Internal error: Expected InstanceKey, got " + next.getClass().getName()); } } } }
private static Set<Pair<CGNode, NewSiteReference>> getFbPrototypes(PointerAnalysis<ObjectVertex> fbPA, final HeapGraph<ObjectVertex> hg, CallGraph CG, CGNode node, int vn) { return getPrototypeSites(fbPA, CG, o -> { PrototypeFieldVertex proto = new PrototypeFieldVertex(PrototypeField.__proto__, o); if (hg.containsNode(proto)) { return new MapIterator<>(hg.getSuccNodes(proto), ObjectVertex.class::cast); } else { return EmptyIterator.instance(); } }, node, vn); }
dump = true; System.err.println("no " + f + " for " + k + "(" + k.getConcreteType() + ")"); } else if (! hg.getSuccNodes(pointerKeyForInstanceField).hasNext()){ dump = true; System.err.println("empty " + f + " for " + k + "(" + k.getConcreteType() + ")");