int j = Y.whichPred(X); OPT_HeapOperand H1 = (OPT_HeapOperand)Phi.getValue(s,j); java.util.Stack S = (java.util.Stack)stacks.get(H1.getHeapType()); OPT_HeapOperand H2 = (OPT_HeapOperand)S.peek(); Phi.setValue(s, j, new OPT_HeapOperand(H2.getHeapVariable()));
for (int j=0; j<Phi.getNumberOfValues(s); j++) { if (Phi.getPred(s,j).block == X) { OPT_HeapOperand H1 = (OPT_HeapOperand)Phi.getValue(s,j); java.util.Stack S = (java.util.Stack)stacks.get(H1.getHeapType()); OPT_HeapOperand H2 = (OPT_HeapOperand)S.peek(); Phi.setValue(s, j, new OPT_HeapOperand(H2.getHeapVariable())); } }
  private static void search2(OPT_BasicBlock X, java.util.HashMap stacks,                               OPT_IR ir ) {    if (DEBUG) System.out.println("SEARCH2 " + X);    OPT_SSADictionary dictionary = ir.HIRInfo.SSADictionary;    for (Enumeration ie = dictionary.getAllInstructions(X);         ie.hasMoreElements();) {      OPT_Instruction A = (OPT_Instruction)ie.nextElement();      if (!dictionary.usesHeapVariable(A) && !dictionary.defsHeapVariable(A))        continue;      if (A.operator() != PHI) {        // replace the Heap variables USED by this instruction        OPT_HeapOperand[] uses = dictionary.getHeapUses(A);        if (uses != null) {          OPT_HeapOperand[] newUses = new OPT_HeapOperand[uses.length];          for (int i = 0; i < uses.length; i++) {            java.util.Stack S = (java.util.Stack)stacks.get                (uses[i].getHeapType());            newUses[i] = (OPT_HeapOperand)((OPT_HeapOperand)S.peek()).copy();            if (DEBUG)              System.out.println("NORMAL USE PEEK " + newUses[i]);          }          dictionary.replaceUses(A, newUses);        }      }      // replace any Heap variable DEF      OPT_HeapOperand[] defs = dictionary.getHeapDefs(A);      if (defs != null) {        OPT_HeapOperand r[] = dictionary.replaceDefs(A, X);        for (int i = 0; i < r.length; i++) {          java.util.Stack S = (java.util.Stack)stacks.get(r[i].getHeapType());          S.push(r[i]);          if (DEBUG)            System.out.println("PUSH " + r[i] + " FOR " + r[i].getHeapType());        }      }    } // end of first loop    for (OPT_BasicBlockEnumeration y = X.getOut(); y.hasMoreElements();) {      OPT_BasicBlock Y = y.next();      if (Y.isExit())        continue;      // replace each USE in each HEAP-PHI function for Y      for (Enumeration hp = dictionary.getHeapPhiInstructions(Y);           hp.hasMoreElements();) {        OPT_Instruction s = (OPT_Instruction)hp.nextElement();        int j = Y.whichPred(X);        OPT_HeapOperand H1 = (OPT_HeapOperand)Phi.getValue(s,j);        java.util.Stack S = (java.util.Stack)stacks.get(H1.getHeapType());        OPT_HeapOperand H2 = (OPT_HeapOperand)S.peek();        Phi.setValue(s, j, new OPT_HeapOperand(H2.getHeapVariable()));      }    } // end of second loop    for (Enumeration c = ir.HIRInfo.dominatorTree.getChildren(X);         c.hasMoreElements();) {      OPT_DominatorTreeNode v = (OPT_DominatorTreeNode)c.nextElement();      search2(v.getBlock(), stacks, ir);    } // end of third loop    for (Enumeration a = dictionary.getAllInstructions(X);          a.hasMoreElements();) {      OPT_Instruction A = (OPT_Instruction)a.nextElement();      // retrieve the Heap Variables defined by A      OPT_HeapOperand[] defs = dictionary.getHeapDefs(A);      if (defs != null) {        for (int i = 0; i < defs.length; i++) {          java.util.Stack S = (java.util.Stack)stacks.get(                                               defs[i].getHeapType());          S.pop();          if (DEBUG) System.out.println("POP " + defs[i].getHeapType());        }      }    } // end of fourth loop    if (DEBUG) System.out.println("END SEARCH2 " + X);  }