Пример #1
0
  private void getRegionsHelper(
      Node node, Map<RegionVar, Set<Field>> dead, List<RegionVar> regions) {
    RegionVar reg = node.getRegion();
    if (regions.contains(reg)) return;

    regions.add(reg);
    if (secondary_index[6]) {
      for (Field f : node.getRep().outfields.keySet()) {
        FieldEdge fe = node.getRep().outfields.get(f);
        assert (fe.src == node);
        if (dead == null || dead.get(reg) == null || !dead.get(reg).contains(fe.field))
          getRegionsHelper(fe.dst.getRep(), dead, regions);
      }
    } else {
      for (Field f : fedges.keySet())
        for (FieldEdge fe : fedges.get(f)) {
          if (fe.src == node) {
            if (dead == null || dead.get(reg) == null || !dead.get(reg).contains(fe.field))
              getRegionsHelper(fe.dst, dead, regions);
          }
        }
    }
  }
Пример #2
0
  protected void addRegionsFrom(
      Node node, Map<RegionVar, Set<Field>> dead, IBitVector<RegionVar> marked) {
    RegionVar reg = node.getRegion();
    if (reg.isHeap() || marked.get(reg)) return;

    marked.set(reg);
    if (secondary_index[6]) {
      for (Field f : node.getRep().outfields.keySet()) {
        FieldEdge fe = node.getRep().outfields.get(f);
        assert (fe.src == node);
        if (dead == null || dead.get(reg) == null || !dead.get(reg).contains(fe.field))
          addRegionsFrom(fe.dst.getRep(), dead, marked);
      }
    } else {
      for (Field f : fedges.keySet())
        for (FieldEdge fe : fedges.get(f)) {
          if (fe.src == node) {
            if (dead == null || dead.get(reg) == null || !dead.get(reg).contains(fe.field))
              addRegionsFrom(fe.dst, dead, marked);
          }
        }
    }
  }