Пример #1
0
  @Override
  public void visitInvokeInst(Quad q) {
    ParamListOperand argList = Invoke.getParamList(q);
    RegisterOperand vo = Invoke.getDest(q);
    int args = argList.length();

    // was args > 1

    if (vo != null && args > 0) {
      Register v = vo.getRegister();
      jq_Method meth = Invoke.getMethod(q).getMethod();
      jq_Class cl = meth.getDeclaringClass();

      if (v.getType().isReferenceType()) {
        //        String mname = meth.getName().toString();

        //        System.out.println("INewColl inspecting call to " + mname);

        if (isCollectionType(cl) && !meth.isStatic()) {
          jq_Type destType = meth.getReturnType();
          //          System.out.println("INewColl saw call to " + meth + " returning " + destType);
          if (isCollectionType(destType)) {
            Register thisObj = Invoke.getParam(q, 0).getRegister();
            int iID = domI.indexOf(q);
            int vID = domV.indexOf(v);
            int thisID = domV.indexOf(thisObj);
            super.add(iID, vID, thisID);
          }
        }
      }
    }
  }
Пример #2
0
  @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");
      }
    }
  }
Пример #3
0
 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 + "\" ";
 }