예제 #1
0
  private static OrdinalSet<InstanceKey> findReachableInstances(
      final PointerAnalysis<InstanceKey> pts, final PointerKey pkStart) {
    final HeapGraph hg = pts.getHeapGraph();
    if (!hg.containsNode(pkStart)) {
      return OrdinalSet.empty();
    }

    final OrdinalSetMapping<InstanceKey> mapping = pts.getInstanceKeyMapping();

    final BitVectorIntSet resultSet = new BitVectorIntSet();

    final NumberedDFSDiscoverTimeIterator<Object> dfsDiscover =
        new NumberedDFSDiscoverTimeIterator<Object>(hg, pkStart);
    while (dfsDiscover.hasNext()) {
      Object obj = dfsDiscover.next();
      if (obj instanceof InstanceKey) {
        InstanceKey ik = (InstanceKey) obj;
        final int ikNum = mapping.getMappedIndex(ik);
        resultSet.add(ikNum);
      }
    }

    final OrdinalSet<InstanceKey> reachable = new OrdinalSet<InstanceKey>(resultSet, mapping);

    return reachable;
  }
 public void addSubgraphForNode(CGNode node) {
   int n = cg.getNumber(node);
   if (!cgNodesVisited.contains(n)) {
     cgNodesVisited.add(n);
     unconditionallyAddConstraintsFromNode(node);
     addNodesForParameters(node);
   }
 }