Example #1
1
  protected void computeEdgeAndThreadNo() {
    Iterator it = iterator();
    int numberOfEdge = 0;
    while (it.hasNext()) {
      List succList = (List) getSuccsOf(it.next());

      numberOfEdge = numberOfEdge + succList.size();
    }
    numberOfEdge = numberOfEdge + startToThread.size();

    System.err.println("**number of edges: " + numberOfEdge);

    System.err.println("**number of threads: " + (startToThread.size() + 1));

    /*	Set keySet = startToThread.keySet();
    Iterator keyIt = keySet.iterator();
    while (keyIt.hasNext()){
    List list = (List)startToThread.get(keyIt.next());
    System.out.println("********start thread:");
    Iterator itit = list.iterator();
    while (itit.hasNext()){
    System.out.println(it.next());
    }
    }
    */

  }
Example #2
0
 protected void testList(List list) {
   //		System.out.println("test list");
   Iterator listIt = list.iterator();
   while (listIt.hasNext()) {
     System.out.println(listIt.next());
   }
 }
Example #3
0
  protected void testStartToThread() {
    System.out.println("=====test startToThread ");
    Set maps = startToThread.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      JPegStmt key = (JPegStmt) entry.getKey();
      Tag tag = (Tag) key.getTags().get(0);
      System.out.println("---key=  " + tag + " " + key);
      /*	    List list = (List)entry.getValue();
      if (list.size()>0){

      System.out.println("**thread set:");
      Iterator it = list.iterator();
      while (it.hasNext()){
      Chain chain =(Chain)it.next();
      Iterator chainIt = chain.iterator();

      System.out.println("the size of chain is: "+chain.size());
      while (chainIt.hasNext()){
      JPegStmt stmt = (JPegStmt)chainIt.next();
      System.out.println(stmt);
      }
      }
      }
      */
    }
    System.out.println("=========startToThread--ends--------");
  }
Example #4
0
  private void insertAfter(JPegStmt node, JPegStmt after) {
    // System.out.println("node: "+node);
    // System.out.println("after: "+after);
    //		System.out.println("succs of node: "+getSuccsOf(node));

    // this must be done first because the succs of node will be chanaged lately
    List succOfAfter = new ArrayList();
    succOfAfter.addAll(getSuccsOf(node));
    unitToSuccs.put(after, succOfAfter);

    Iterator succsIt = getSuccsOf(node).iterator();
    while (succsIt.hasNext()) {
      Object succ = succsIt.next();
      List pred = getPredsOf(succ);
      pred.remove(node);
      pred.add(after);
    }

    List succOfNode = new ArrayList();
    succOfNode.add(after);
    unitToSuccs.put(node, succOfNode);

    List predOfAfter = new ArrayList();
    predOfAfter.add(node);
    unitToPreds.put(after, predOfAfter);

    //	buildPredecessor(Chain pegChain);
  }
Example #5
0
  protected void testPegChain(Chain chain) {
    System.out.println("******** chain********");
    Iterator it = chain.iterator();
    while (it.hasNext()) {
      /*Object o = it.next();
      System.out.println(o);
      if (!(o instanceof JPegStmt))  System.out.println("not instanceof JPegStmt: "+o);
      JPegStmt s = (JPegStmt)o;
      */
      JPegStmt stmt = (JPegStmt) it.next();
      System.out.println(stmt.toString());
      /*if (stmt.getName().equals("start")){

      System.out.println("find start method in : " + stmt.toString() );
      List list =(List)startToThread.get(stmt);
      Iterator chainIt = list.iterator();
      while (chainIt.hasNext()){
      Chain chain = (Chain)chainIt.next();
      Iterator subit = chain.iterator();
      while (subit.hasNext()){
      System.out.println("**" + ((JPegStmt)subit.next()).toString());
      }
      }
      System.out.println("$$$$$$returing to main chain");
      }
      */
    }
  }
Example #6
0
 // helper function
 protected void testIterator() {
   System.out.println("********begin test iterator*******");
   Iterator testIt = iterator();
   while (testIt.hasNext()) {
     System.out.println(testIt.next());
   }
   System.out.println("********end test iterator*******");
   System.out.println("=======size is: " + size());
 }
Example #7
0
 protected void testSet(Set set, String name) {
   System.out.println("$test set " + name);
   Iterator setIt = set.iterator();
   while (setIt.hasNext()) {
     Object s = setIt.next();
     // JPegStmt s = (JPegStmt)setIt.next();
     // Tag tag = (Tag)s.getTags().get(0);
     System.out.println(s);
   }
 }
Example #8
0
 protected void testSynch() {
   Iterator<List> it = synch.iterator();
   System.out.println("========test synch======");
   while (it.hasNext()) {
     // JPegStmt s = (JPegStmt)it.next();
     // Tag tag = (Tag)s.getTags().get(0);
     // System.out.println(tag+" "+s);
     System.out.println(it.next());
   }
   System.out.println("========end test synch======");
 }
Example #9
0
 protected void testUnitToPeg(HashMap unitToPeg) {
   System.out.println("=====test unitToPeg ");
   Set maps = unitToPeg.entrySet();
   for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
     Map.Entry entry = (Map.Entry) iter.next();
     System.out.println("---key=  " + entry.getKey());
     JPegStmt s = (JPegStmt) entry.getValue();
     System.out.println("--value= " + s);
   }
   System.out.println("=========unitToPeg--ends--------");
 }
Example #10
0
  public void computeSynchNodes() {
    int num = 0;
    Set maps = monitor.entrySet();

    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      FlowSet fs = (FlowSet) entry.getValue();
      num += fs.size();
    }
    System.err.println("synch objects: " + num);
  }
Example #11
0
  protected void addTag() {
    // add tag for each stmt
    Iterator it = iterator();
    //		int count = 0;

    while (it.hasNext()) {
      JPegStmt stmt = (JPegStmt) it.next();
      int count = Counter.getTagNo();
      //			count++;
      StringTag t = new StringTag(Integer.toString(count));
      stmt.addTag(t);
    }
  }
Example #12
0
  protected void testJoinStmtToThread() {
    System.out.println("=====test JoinStmtToThread");
    Set maps = threadNameToStart.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      Object key = entry.getKey();

      System.out.println("---key=  " + key);

      System.out.println("value: " + entry.getValue());
    }
    System.out.println("=========JoinStmtToThread--ends--------");
  }
Example #13
0
  private void createWorkList(
      LinkedList<Object> changedUnits, HashSet<Object> changedUnitsSet, PegChain chain) {
    // Depth first scan
    Iterator it = chain.getHeads().iterator();
    Set<Object> gray = new HashSet<Object>();

    while (it.hasNext()) {
      Object head = it.next();
      if (!gray.contains(head)) {

        visitNode(gray, head, changedUnits, changedUnitsSet);
      }
    }
  }
Example #14
0
  protected void testThreadNameToStart() {
    System.out.println("=====test ThreadNameToStart");
    Set maps = threadNameToStart.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      Object key = entry.getKey();

      System.out.println("---key=  " + key);
      JPegStmt stmt = (JPegStmt) entry.getValue();
      Tag tag1 = (Tag) stmt.getTags().get(0);
      System.out.println("value: " + tag1 + " " + stmt);
    }
    System.out.println("=========ThreadNameToStart--ends--------");
  }
Example #15
0
  private boolean removeBeginNode() {
    List heads = getHeads();
    if (heads.size() != 1) {
      // System.out.println("heads: "+heads);
      // System.out.println("Error: the size of heads is not equal to 1!");
      return false;
      //	    System.exit(1);
    } else {
      JPegStmt head = (JPegStmt) heads.get(0);
      // System.out.println("test head: "+head);
      if (!head.getName().equals("begin")) {
        System.err.println("Error: the head is not begin node!");
        System.exit(1);
      }
      // remove begin node from heads list
      heads.remove(0);
      // set the preds list of the succs of head to a new list and put succs of head into heads
      Iterator succOfHeadIt = getSuccsOf(head).iterator();
      while (succOfHeadIt.hasNext()) {

        JPegStmt succOfHead = (JPegStmt) succOfHeadIt.next();

        unitToPreds.put(succOfHead, new ArrayList());
        // put succs of head into heads
        heads.add(succOfHead);
      }
      // remove begin node from inlinee Peg
      if (!mainPegChain.remove(head)) {
        System.err.println("fail to remove begin node in from mainPegChain!");
        System.exit(1);
      }
      if (!allNodes.contains(head)) {
        System.err.println("fail to find begin node in FlowSet allNodes!");
        System.exit(1);
      } else {
        allNodes.remove(head);
      }

      // remove begin node from unitToSuccs
      if (unitToSuccs.containsKey(head)) {
        unitToSuccs.remove(head);
      }
    }

    return true;
  }
Example #16
0
  public String toString() {
    Iterator it = iterator();
    StringBuffer buf = new StringBuffer();
    while (it.hasNext()) {
      JPegStmt u = (JPegStmt) it.next();
      buf.append("u is: " + u + "\n");
      List l = new ArrayList();
      l.addAll(getPredsOf(u));
      buf.append("preds: " + l + "\n");
      // buf.append(u.toString() + '\n');
      l = new ArrayList();
      l.addAll(getSuccsOf(u));
      buf.append("succs: " + l + "\n");
    }

    return buf.toString();
  }
Example #17
0
  /**
   * given a DelayabilityAnalysis and the computations of each unit, calculates the latest
   * computation-point for each expression.<br>
   * the <code>equivRhsMap</code> could be calculated on the fly, but it is <b>very</b> likely that
   * it already exists (as similar maps are used for calculating Earliestness, Delayed,...<br>
   * the shared set allows more efficient set-operations, when they the computation is merged with
   * other analyses/computations.
   *
   * @param dg a ExceptionalUnitGraph
   * @param delayed the delayability-analysis of the same graph.
   * @param equivRhsMap all computations of the graph
   * @param set the shared flowSet
   */
  public LatestComputation(
      UnitGraph unitGraph, DelayabilityAnalysis delayed, Map equivRhsMap, BoundedFlowSet set) {
    unitToLatest = new HashMap<Unit, FlowSet>(unitGraph.size() + 1, 0.7f);

    Iterator unitIt = unitGraph.iterator();
    while (unitIt.hasNext()) {
      /* create a new Earliest-list for each unit */
      Unit currentUnit = (Unit) unitIt.next();

      /* basically the latest-set is:
       * (delayed) INTERSECT (comp UNION (UNION_successors ~Delayed)) =
       * (delayed) MINUS ((INTERSECTION_successors Delayed) MINUS comp).
       */

      FlowSet delaySet = (FlowSet) delayed.getFlowBefore(currentUnit);

      /* Calculate (INTERSECTION_successors Delayed) */
      FlowSet succCompSet = (FlowSet) set.topSet();
      List succList = unitGraph.getSuccsOf(currentUnit);
      Iterator succIt = succList.iterator();
      while (succIt.hasNext()) {
        Unit successor = (Unit) succIt.next();
        succCompSet.intersection((FlowSet) delayed.getFlowBefore(successor), succCompSet);
      }
      /* remove the computation of this set: succCompSet is then:
       * ((INTERSECTION_successors Delayed) MINUS comp) */
      if (equivRhsMap.get(currentUnit) != null) succCompSet.remove(equivRhsMap.get(currentUnit));

      /* make the difference: */
      FlowSet latest = (FlowSet) delaySet.emptySet();
      delaySet.difference(succCompSet, latest);

      unitToLatest.put(currentUnit, latest);
    }
  }
Example #18
0
 private void updateMonitor(MonitorSet ms, Object unit) {
   // System.out.println("===inside updateMonitor===");
   // ml.test();
   Iterator it = ms.iterator();
   while (it.hasNext()) {
     Object obj = it.next();
     if (obj instanceof MonitorDepth) {
       MonitorDepth md = (MonitorDepth) obj;
       String objName = md.getObjName();
       if (monitor.containsKey(objName)) {
         if (md.getDepth() > 0) {
           monitor.get(objName).add(unit);
           // System.out.println("add to monitorset "+unit);
         }
       } else {
         FlowSet monitorObjs = new ArraySparseSet();
         monitorObjs.add(unit);
         monitor.put(objName, monitorObjs);
         // System.out.println("put into monitor: "+objName);
       }
     }
   }
 }
Example #19
0
  private void visitNode(
      Set<Object> gray,
      Object obj,
      LinkedList<Object> changedUnits,
      HashSet<Object> changedUnitsSet) {

    gray.add(obj);
    changedUnits.addLast(obj);
    changedUnitsSet.add(obj);
    nodes.add(obj);
    valueBefore.add(newInitialFlow());
    valueAfter.add(newInitialFlow());
    Iterator succsIt = graph.getSuccsOf(obj).iterator();
    if (g.getSuccsOf(obj).size() > 0) {
      while (succsIt.hasNext()) {
        Object succ = succsIt.next();
        if (!gray.contains(succ)) {

          visitNode(gray, succ, changedUnits, changedUnitsSet);
        }
      }
    }
  }
Example #20
0
  private void insertBefore(JPegStmt node, JPegStmt enter) {

    // build preds of before

    List predOfBefore = new ArrayList();
    predOfBefore.addAll(getPredsOf(node));
    unitToPreds.put(enter, predOfBefore);

    //	System.out.println("put into unitToPreds enter: "+enter);
    //	System.out.println("put into unitToPreds value: "+predOfBefore);
    Iterator predsIt = getPredsOf(node).iterator();

    // build succs of former preds of node
    while (predsIt.hasNext()) {
      Object pred = predsIt.next();

      List succ = getSuccsOf(pred);
      succ.remove(node);
      succ.add(enter);
      //	    System.out.println("in unitToPred pred: "+pred);
      //	    System.out.println("in unitToPred value is: "+succ);
    }

    List succOfBefore = new ArrayList();
    succOfBefore.add(node);
    unitToSuccs.put(enter, succOfBefore);
    //	System.out.println("put into unitToSuccs enter: "+enter);
    // System.out.println("put into unitToSuccs value: "+succOfBefore);

    List predOfNode = new ArrayList();
    predOfNode.add(enter);
    unitToPreds.put(node, predOfNode);
    // System.out.println("put into unitToPreds enter: "+node);
    // System.out.println("put into unitToPreds value: "+predOfNode);
    // buildPreds();

  }
Example #21
0
  public void testMonitor() {
    System.out.println("=====test monitor size: " + monitor.size());
    Set maps = monitor.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      String key = (String) entry.getKey();

      System.out.println("---key=  " + key);
      FlowSet list = (FlowSet) entry.getValue();
      if (list.size() > 0) {

        System.out.println("**set:  " + list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
          Object obj = it.next();
          if (obj instanceof JPegStmt) {
            JPegStmt stmt = (JPegStmt) obj;
            Tag tag1 = (Tag) stmt.getTags().get(0);
            System.out.println(tag1 + " " + stmt);
          } else {
            System.out.println("---list---");
            Iterator listIt = ((List) obj).iterator();
            while (listIt.hasNext()) {
              Object oo = listIt.next();
              if (oo instanceof JPegStmt) {
                JPegStmt unit = (JPegStmt) oo;
                Tag tag = (Tag) unit.getTags().get(0);
                System.out.println(tag + " " + unit);
              } else System.out.println(oo);
            }
            System.out.println("---list--end-");
          }
        }
      }
    }
    System.out.println("=========monitor--ends--------");
  }
Example #22
0
  public void computeMonitorObjs() {
    Set maps = monitor.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();

      FlowSet fs = (FlowSet) entry.getValue();
      Iterator it = fs.iterator();
      while (it.hasNext()) {
        Object obj = it.next();
        if (!monitorObjs.contains(obj)) monitorObjs.add(obj);
      }
    }
  }
Example #23
0
 protected void buildPreds() {
   buildPredecessor(mainPegChain);
   Set maps = getStartToThread().entrySet();
   for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
     Map.Entry entry = (Map.Entry) iter.next();
     List runMethodChainList = (List) entry.getValue();
     Iterator it = runMethodChainList.iterator();
     while (it.hasNext()) {
       Chain chain = (Chain) it.next();
       //	System.out.println("chain is null: "+(chain == null));
       buildPredecessor(chain);
     }
   }
 }
Example #24
0
  private void createWorkList(LinkedList<Object> changedUnits, HashSet<Object> changedUnitsSet) {
    createWorkList(changedUnits, changedUnitsSet, g.getMainPegChain());

    Set maps = g.getStartToThread().entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      List runMethodChainList = (List) entry.getValue();
      Iterator it = runMethodChainList.iterator();
      while (it.hasNext()) {
        PegChain chain = (PegChain) it.next();
        createWorkList(changedUnits, changedUnitsSet, chain);
      }
    }
  }
Example #25
0
  public void testWaitingNodes() {
    System.out.println("------waiting---begin");
    Set maps = waitingNodes.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      System.out.println("---key=  " + entry.getKey());
      FlowSet fs = (FlowSet) entry.getValue();
      if (fs.size() > 0) {

        System.out.println("**waiting nodes set:");
        Iterator it = fs.iterator();
        while (it.hasNext()) {
          JPegStmt unit = (JPegStmt) it.next();

          System.out.println(unit.toString());
        }
      }
    }
    System.out.println("------------waitingnodes---ends--------");
  }
Example #26
0
  public boolean addPeg(PegGraph pg, Chain chain) {
    if (!pg.removeBeginNode()) return false;
    //		System.out.println("adding one peg into another");

    //		System.out.println("after removeBeginNode===");
    //	pg.testPegChain();
    // System.out.println(pg);

    // put every node of peg into this
    Iterator mainIt = pg.mainIterator();

    while (mainIt.hasNext()) {
      JPegStmt s = (JPegStmt) mainIt.next();
      //			System.out.println("add to mainPegChain: "+s);
      mainPegChain.addLast(s);
      //			if (chain.contains(s)){
      //				System.err.println("error! chain contains: "+s);
      //				System.exit(1);
      //			}
      //			else
      //				chain.addLast(s);

    }
    Iterator it = pg.iterator();
    while (it.hasNext()) {
      JPegStmt s = (JPegStmt) it.next();
      // System.out.println("add to allNodes: "+s);
      if (allNodes.contains(s)) {
        System.err.println("error! allNodes contains: " + s);
        System.exit(1);
      } else allNodes.add(s);
    }
    //	testPegChain();
    //	testIterator();
    unitToSuccs.putAll(pg.getUnitToSuccs());
    unitToPreds.putAll(pg.getUnitToPreds());
    //	testUnitToSucc();
    // testUnitToPred();
    //		buildMaps(pg); // RLH
    return true;
  }
Example #27
0
  public void testMonitor() {
    System.out.println("=====test monitor size: " + monitor.size());
    Set maps = monitor.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      String key = (String) entry.getKey();

      System.out.println("---key=  " + key);
      FlowSet list = (FlowSet) entry.getValue();
      if (list.size() > 0) {

        System.out.println("**set:  " + list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
          JPegStmt stmt = (JPegStmt) it.next();
          Tag tag1 = (Tag) stmt.getTags().get(0);
          System.out.println(tag1 + " " + stmt);
        }
      }
    }
    System.out.println("=========monitor--ends--------");
  }
Example #28
0
  protected void testUnitToSucc() {
    System.out.println("=====test unitToSucc ");
    Set maps = unitToSuccs.entrySet();
    for (Iterator iter = maps.iterator(); iter.hasNext(); ) {
      Map.Entry entry = (Map.Entry) iter.next();
      JPegStmt key = (JPegStmt) entry.getKey();
      Tag tag = (Tag) key.getTags().get(0);
      System.out.println("---key=  " + tag + " " + key);
      List list = (List) entry.getValue();
      if (list.size() > 0) {

        System.out.println("**succ set: size: " + list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
          JPegStmt stmt = (JPegStmt) it.next();
          Tag tag1 = (Tag) stmt.getTags().get(0);
          System.out.println(tag1 + " " + stmt);
        }
      }
    }
    System.out.println("=========unitToSucc--ends--------");
  }
Example #29
0
  private void buildHeadsAndTails() {

    List tailList = new ArrayList();
    List headList = new ArrayList();

    // Build the sets
    {
      Iterator unitIt = mainPegChain.iterator();

      while (unitIt.hasNext()) {
        JPegStmt s = (JPegStmt) unitIt.next();

        List succs = unitToSuccs.get(s);
        if (succs.size() == 0) tailList.add(s);
        if (!unitToPreds.containsKey(s)) {
          System.err.println("unitToPreds does not contain key: " + s);
          System.exit(1);
        }
        List preds = unitToPreds.get(s);
        if (preds.size() == 0) headList.add(s);
        // System.out.println("head is:");
      }
    }
    tails = (List) tailList;
    heads = (List) headList;
    //	tails = Collections.unmodifiableList(tailList);
    // heads = Collections.unmodifiableList(headList);

    Iterator tmpIt = heads.iterator();

    while (tmpIt.hasNext()) {
      Object temp = tmpIt.next();
      // System.out.println(temp);
    }

    buildPredecessor(mainPegChain);
  }
Example #30
0
  protected void doAnalysis() {
    LinkedList<Object> changedUnits = new LinkedList<Object>();
    HashSet<Object> changedUnitsSet = new HashSet<Object>();

    int numNodes = graph.size();
    int numComputations = 0;

    // Set initial values and nodes to visit.

    createWorkList(changedUnits, changedUnitsSet);

    // testWorkList(changedUnits);

    // Set initial values for entry points
    {
      Iterator it = graph.getHeads().iterator();

      while (it.hasNext()) {
        Object s = it.next();

        // unitToBeforeFlow.put(s, entryInitialFlow());
        nodes.add(s);
        valueBefore.add(entryInitialFlow());
      }
    }

    // Perform fixed point flow analysis
    {
      Object previousAfterFlow = newInitialFlow();

      while (!changedUnits.isEmpty()) {
        Object beforeFlow;
        Object afterFlow;

        Object s = changedUnits.removeFirst();
        Tag tag = (Tag) ((JPegStmt) s).getTags().get(0);
        // System.out.println("===unit is: "+tag+" "+s);
        changedUnitsSet.remove(s);

        // copy(unitToAfterFlow.get(s), previousAfterFlow);
        // add for debug april 6
        int pos = nodes.indexOf(s);
        copy(valueAfter.elementAt(pos), previousAfterFlow);
        // end add for debug april
        // Compute and store beforeFlow
        {
          List preds = graph.getPredsOf(s);

          // beforeFlow = unitToBeforeFlow.get(s);

          beforeFlow = valueBefore.elementAt(pos);

          if (preds.size() == 1) {
            // copy(unitToAfterFlow.get(preds.get(0)), beforeFlow);
            copy(valueAfter.elementAt(nodes.indexOf(preds.get(0))), beforeFlow);
          } else if (preds.size() != 0) {
            Iterator predIt = preds.iterator();
            Object obj = predIt.next();

            // copy(unitToAfterFlow.get(obj), beforeFlow);
            copy(valueAfter.elementAt(nodes.indexOf(obj)), beforeFlow);

            while (predIt.hasNext()) {
              JPegStmt stmt = (JPegStmt) predIt.next();
              if (stmt.equals(obj)) {
                // System.out.println("!!!same object!!!");
                continue;
              }
              Tag tag1 = (Tag) stmt.getTags().get(0);
              // System.out.println("pred: "+tag1+" "+stmt);

              // Object otherBranchFlow = unitToAfterFlow.get(stmt);
              if (nodes.indexOf(stmt) >= 0) // RLH
              {
                Object otherBranchFlow = valueAfter.elementAt(nodes.indexOf(stmt));

                merge(beforeFlow, otherBranchFlow, beforeFlow);
              }
            }
          }
        }

        // Compute afterFlow and store it.
        {
          // afterFlow = unitToAfterFlow.get(s);
          afterFlow = valueAfter.elementAt(nodes.indexOf(s));
          flowThrough(beforeFlow, s, afterFlow);

          // unitToAfterFlow.put(s, afterFlow);
          valueAfter.set(nodes.indexOf(s), afterFlow);
          // System.out.println("update afterFlow nodes: "+s);
          // System.out.println("afterFlow: "+afterFlow);
          // ((MonitorSet)unitToAfterFlow.get(s)).test();

          numComputations++;
        }

        // Update queue appropriately

        if (!afterFlow.equals(previousAfterFlow)) {

          Iterator succIt = graph.getSuccsOf(s).iterator();

          while (succIt.hasNext()) {
            Object succ = succIt.next();

            if (!changedUnitsSet.contains(succ)) {
              changedUnits.addLast(succ);
              changedUnitsSet.add(succ);
              /*if (succ instanceof JPegStmt){
              Tag tag1 = (Tag)((JPegStmt)succ).getTags().get(0);

              System.out.println("add to worklist: "+tag1+" "+succ);
              }
              else
              System.out.println("add to worklist: "+succ);
              */
            }
          }
        }
      }
    }

    // G.v().out.println(graph.getBody().getMethod().getSignature() + " numNodes: " + numNodes +
    //    " numComputations: " + numComputations + " avg: " + Main.truncatedOf((double)
    // numComputations / numNodes, 2));

    Timers.v().totalFlowNodes += numNodes;
    Timers.v().totalFlowComputations += numComputations;
  }