コード例 #1
0
ファイル: Graph.java プロジェクト: safdariqbal/frex
  /* process call edge constraint */
  public void process(CallConstraint c) {
    Node csrc = c.ncaller.getRep();
    Node cdst = c.ncallee.getRep();
    assert (cdst.graph == this);

    if (heapfix && csrc.graph == this && !csrc.isheap && cdst.isheap)
      w.addFirst(new UnifyConstraint(csrc, cdst));

    Collection<CallEdge> ced = cedges.get(c.call);
    if (ced != null)
      for (CallEdge e : ced) {
        Node esrc = e.src.getRep();
        Node edst = e.dst.getRep();
        if (edst == cdst && e.call.equals(c.call)) {
          if (esrc != csrc) {
            Graph g = esrc.graph;
            assert (g != this || !Options.mergeGraphs.value);
            g.w.addFirst(new UnifyConstraint(esrc, csrc));
          }
          return;
        }
      }
    else {
      ced = new ArrayList<CallEdge>();
      cedges.put(c.call, ced);
    }

    ced.add(new CallEdge(csrc, cdst, c.call));
  }
コード例 #2
0
ファイル: Graph.java プロジェクト: safdariqbal/frex
 private static void addInField(Node n, Field f, FieldEdge e) {
   Collection<FieldEdge> s = n.infields.get(f);
   if (s == null) {
     s = new ArrayList<FieldEdge>();
     n.infields.put(f, s);
   }
   s.add(e);
 }
コード例 #3
0
ファイル: Graph.java プロジェクト: safdariqbal/frex
  /* process field edge constraint */
  public void process(FieldConstraint c) {
    Node csrc = c.src.getRep();
    Node cdst = c.dst.getRep();
    assert (csrc.graph == this);
    assert (cdst.graph == this);

    if (heapfix && csrc.isheap && !cdst.isheap) w.addFirst(new UnifyConstraint(csrc, cdst));

    Collection<FieldEdge> fed = fedges.get(c.field);
    if (secondary_index[9]) {
      FieldEdge e = csrc.outfields.get(c.field);
      if (e != null) {
        if (e.dst != cdst) w.addFirst(new UnifyConstraint(e.dst, cdst));
        return;
      }
    } else {
      if (fed != null)
        for (FieldEdge e : fed) {
          Node esrc = e.src.getRep();
          Node edst = e.dst.getRep();
          assert (e.field.equals(c.field));
          if (esrc == csrc) {
            if (edst != cdst) w.addFirst(new UnifyConstraint(edst, cdst));
            return;
          }
        }
    }

    FieldEdge e = new FieldEdge(csrc, cdst, c.field);

    if (fed == null) {
      fed = new ArrayList<FieldEdge>();
      fedges.put(c.field, fed);
    }
    fed.add(e);
    if (secondary_index[1]) {
      csrc.outfields.put(e.field, e);
      addInField(cdst, e.field, e);
    }

    // Merge nodes according to Tag information
    Node find =
        Options.detailed.value
            ? reachesTag(csrc, cdst.tag, new HashSet<Node>())
            : containsTag(cdst.tag);

    if (find != null) w.addFirst(new UnifyConstraint(cdst, find));
  }