コード例 #1
0
 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
ファイル: RelLE.java プロジェクト: gowthamk/JChord
 private void process(BasicBlock bb, TIntArrayList locks) {
   int n = bb.size();
   int k = locks.size();
   for (int i = 0; i < n; i++) {
     Quad q = bb.getQuad(i);
     Operator op = q.getOperator();
     if (op instanceof Monitor) {
       if (op instanceof MONITORENTER) {
         TIntArrayList locks2 = new TIntArrayList(k + 1);
         for (int j = 0; j < k; j++) locks2.add(locks.get(j));
         int lIdx = domL.indexOf(q);
         assert (lIdx >= 0);
         locks2.add(lIdx);
         locks = locks2;
         k++;
       } else {
         k--;
         TIntArrayList locks2 = new TIntArrayList(k);
         for (int j = 0; j < k; j++) locks2.add(locks.get(j));
         locks = locks2;
       }
     } else if (op.isHeapInst() && k > 0) {
       int eIdx = domE.indexOf(q);
       assert (eIdx >= 0);
       add(locks.get(k - 1), eIdx);
     }
   }
   for (Object o : bb.getSuccessors()) {
     BasicBlock bb2 = (BasicBlock) o;
     if (!visited.contains(bb2)) {
       visited.add(bb2);
       process(bb2, locks);
     }
   }
 }
コード例 #3
0
ファイル: RelConfWrites.java プロジェクト: johneleks/jchord
  @Override
  public void visitInvokeInst(Quad q) {

    int optPos = ConfDefines.confOptionWritePos(q);
    if (optPos >= 0) {
      int i_id = domI.indexOf(q);

      //      int o_id = domUV.indexOf(vo.getRegister());

      ParamListOperand plo = Invoke.getParamList(q);
      if (plo.length() > optPos) {
        RegisterOperand arg = Invoke.getParam(q, optPos);
        int parm_id = domV.indexOf(arg.getRegister());
        if (i_id > -1 && parm_id > -1) add(i_id, 0, parm_id);
      } else {
        System.err.println(
            "trouble on "
                + method.getName()
                + q.getLineNumber()
                + " expected at least "
                + optPos
                + " params");
      }
    }
  }
コード例 #4
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 + "\" ";
 }
コード例 #5
0
 public void visitHeapInst(Quad q) {
   Operator op = q.getOperator();
   if (op instanceof AStore) {
     if (((AStore) op).getType().isReferenceType()) {
       Operand rx = AStore.getValue(q);
       if (rx instanceof RegisterOperand) {
         RegisterOperand ro = (RegisterOperand) rx;
         Register r = ro.getRegister();
         RegisterOperand bo = (RegisterOperand) AStore.getBase(q);
         Register b = bo.getRegister();
         int mIdx = domM.indexOf(ctnrMethod);
         assert (mIdx >= 0);
         int rIdx = domV.indexOf(r);
         assert (rIdx >= 0);
         int bIdx = domV.indexOf(b);
         assert (bIdx >= 0);
         int fIdx = 0;
         add(mIdx, bIdx, fIdx, rIdx);
       }
     }
     return;
   }
   if (op instanceof Putfield) {
     jq_Field f = Putfield.getField(q).getField();
     if (f.getType().isReferenceType()) {
       Operand rx = Putfield.getSrc(q);
       if (rx instanceof RegisterOperand) {
         Operand bx = Putfield.getBase(q);
         if (bx instanceof RegisterOperand) {
           RegisterOperand bo = (RegisterOperand) bx;
           RegisterOperand ro = (RegisterOperand) rx;
           Register b = bo.getRegister();
           Register r = ro.getRegister();
           int mIdx = domM.indexOf(ctnrMethod);
           assert (mIdx >= 0);
           int bIdx = domV.indexOf(b);
           assert (bIdx >= 0);
           int rIdx = domV.indexOf(r);
           assert (rIdx >= 0);
           int fIdx = domF.indexOf(f);
           assert (fIdx >= 0);
           add(mIdx, bIdx, fIdx, rIdx);
         }
       }
     }
   }
 }
コード例 #6
0
 public void visitHeapInst(Quad q) {
   Operator op = q.getOperator();
   if (op instanceof ALoad) {
     if (!((ALoad) op).getType().isReferenceType()) {
       RegisterOperand lo = ALoad.getDest(q);
       Register l = lo.getRegister();
       RegisterOperand bo = (RegisterOperand) ALoad.getBase(q);
       Register b = bo.getRegister();
       int mIdx = domM.indexOf(ctnrMethod);
       assert (mIdx != -1);
       int lIdx = domU.indexOf(l);
       assert (lIdx != -1);
       int bIdx = domV.indexOf(b);
       assert (bIdx != -1);
       int fIdx = 0;
       add(mIdx, lIdx, bIdx, fIdx);
     }
     return;
   }
   if (op instanceof Getfield) {
     FieldOperand fo = Getfield.getField(q);
     fo.resolve();
     jq_Field f = fo.getField();
     if (!f.getType().isReferenceType()) {
       Operand bx = Getfield.getBase(q);
       if (bx instanceof RegisterOperand) {
         RegisterOperand bo = (RegisterOperand) bx;
         Register b = bo.getRegister();
         RegisterOperand lo = Getfield.getDest(q);
         Register l = lo.getRegister();
         int mIdx = domM.indexOf(ctnrMethod);
         assert (mIdx != -1);
         int bIdx = domV.indexOf(b);
         assert (bIdx != -1);
         int lIdx = domU.indexOf(l);
         assert (lIdx != -1);
         int fIdx = domF.indexOf(f);
         if (fIdx == -1) {
           System.out.println("WARNING: MgetInstFldInst: method: " + ctnrMethod + " quad: " + q);
         } else add(mIdx, lIdx, bIdx, fIdx);
       } else assert (bx instanceof AConstOperand);
     }
   }
 }