public void fill() {
   DomM domM = (DomM) doms[0];
   DomV domV = (DomV) doms[1];
   DomH domH = (DomH) doms[2];
   int numA = domH.getLastA() + 1;
   for (int hIdx = 1; hIdx < numA; hIdx++) {
     Quad q = (Quad) domH.get(hIdx);
     jq_Method m = q.getMethod();
     int mIdx = domM.indexOf(m);
     assert (mIdx >= 0);
     Operator op = q.getOperator();
     RegisterOperand vo;
     if (op instanceof New) vo = New.getDest(q);
     else if (op instanceof NewArray) vo = NewArray.getDest(q);
     else if (op instanceof Invoke) vo = Invoke.getDest(q);
     else if (op instanceof MultiNewArray) vo = NewArray.getDest(q);
     else {
       Messages.fatal("Unknown quad in domain H: " + q);
       vo = null;
     }
     Register v = vo.getRegister();
     int vIdx = domV.indexOf(v);
     if (vIdx >= 0) add(mIdx, vIdx, hIdx);
   }
 }
示例#2
0
文件: DomC.java 项目: gowthamk/JChord
 public String toXMLAttrsString(Ctxt cVal) {
   if (domH == null) domH = (DomH) ClassicProject.g().getTrgt("H");
   if (domI == null) domI = (DomI) ClassicProject.g().getTrgt("I");
   Quad[] elems = cVal.getElems();
   int n = elems.length;
   if (n == 0) return "";
   String s = "ids=\"";
   for (int i = 0; i < n; i++) {
     Quad eVal = elems[i];
     Operator op = eVal.getOperator();
     if (op instanceof New || op instanceof NewArray || op instanceof MultiNewArray) {
       int hIdx = domH.indexOf(eVal);
       s += "H" + hIdx;
     } else if (op instanceof Invoke) {
       int iIdx = domI.indexOf(eVal);
       s += "I" + iIdx;
     } else assert false;
     if (i < n - 1) s += " ";
   }
   return s + "\" ";
 }