public Iterator<CGNode> getPredNodes(CGNode N) { IntSet s = getPredNodeNumbers(N); if (s == null) { return EmptyIterator.instance(); } else { return new IntMapIterator<CGNode>(s.intIterator(), toNode); } }
/** check that the types of all instance keys are assignable to declared type of pointer key */ private void checkTypes(IntSet b) { assert PARANOID; if (b == null) return; if (!(pointerKey instanceof LocalPointerKey)) { return; } final LocalPointerKey lpk = (LocalPointerKey) pointerKey; CGNode node = lpk.getNode(); final IClassHierarchy cha = node.getClassHierarchy(); final IR ir = node.getIR(); if (ir == null) return; TypeInference ti = TypeInference.make(ir, false); final IClass type = ti.getType(lpk.getValueNumber()).getType(); if (type == null) return; // don't perform checking for exception variables if (cha.isAssignableFrom(cha.lookupClass(TypeReference.JavaLangThrowable), type)) { return; } b.foreach( new IntSetAction() { public void act(int x) { InstanceKey ik = instanceKeys.getMappedObject(x); IClass concreteType = ik.getConcreteType(); if (!cha.isAssignableFrom(type, concreteType)) { System.err.println("BOOM"); System.err.println(ir); System.err.println(lpk + " type " + type); System.err.println(ik + " type " + concreteType); Assertions.UNREACHABLE(); } } }); }
protected Set<CGNode> getPossibleTargets(CallSiteReference site) { Object result = targets.get(site.getProgramCounter()); if (result == null) { return Collections.emptySet(); } else if (result instanceof CGNode) { Set<CGNode> s = Collections.singleton((CGNode) result); return s; } else { IntSet s = (IntSet) result; HashSet<CGNode> h = HashSetFactory.make(s.size()); for (IntIterator it = s.intIterator(); it.hasNext(); ) { h.add(getCallGraph().getNode(it.next())); } return h; } }