Esempio n. 1
0
  protected RegionVar getUniqueRegionOf(Var var) {
    assert (var != null && varmap.get(var) != null)
        : " Var " + var + method + " " + var.getDeclaringMethod();
    Node node = (varmap.get(var)).get(null);
    if (node == null) return null;

    return node.getRep().getRegion();
  }
Esempio n. 2
0
 public void checki(boolean basic, Var x, Field f, Var y, Field g) {
   fail = false;
   if (!basic) {
     if (x.getType().getKind() == TypeIR.Kind.VOID) fail = true;
     if (y.getType().getKind() == TypeIR.Kind.VOID) fail = true;
     if (fail) {
       assert (false);
     }
   }
   assertion(basic, x, f);
   assertion(basic, y, g);
   if (fail) {
     assert (false);
     System.out.println(" Overall ! ");
     System.out.println(x.getType());
     if (f != null) System.out.println(" f " + f.getType());
     System.out.println(y.getType());
     if (g != null) System.out.println(" g " + g.getType());
   }
 }
Esempio n. 3
0
 private void assertion(boolean basic, Var x, Field f) {
   if (basic) {
     if (x.getType().getKind() != TypeIR.Kind.BASIC) {
       if (f == null) {
         System.out.println(" 1mm " + x.getType());
         fail = true;
       }
       if (f.getType().getKind() != TypeIR.Kind.BASIC) {
         System.out.println(" xxmm " + x.getType());
         System.out.println(" 2mm " + f.getName() + " " + f.getType());
         fail = true;
       }
     }
   } else {
     if (x.getType().getKind() == TypeIR.Kind.BASIC) {
       System.out.println(" 3mm " + x.getType());
       fail = true;
     }
     if (f != null && f.getType().getKind() == TypeIR.Kind.BASIC) {
       System.out.println(" 4mm " + f.getName() + " " + f.getType());
       fail = true;
     }
   }
 }
Esempio n. 4
0
  /* Processing assignments of actuals to formals at a call
  site. The first parameter is the call instruction. The second
  is the formal parameter. The last two represent the variable or
  the field being passed.

  For return values, the second parameter is the formal return
  variable in the callee, and the last two parameters are the
  variable/field that the call is assigned to. */
  public void assignParams(Call call, Var p, Var x, Field f, boolean isBasic) {

    if (!isBasic) {
      Method callee = call.getCallee();
      Graph gcallee = PointsToAnalysis.v().getGraph(callee);

      Node nodeL = gcallee.getNode(p, null);
      Node nodeR = this.getNode(x, f);
      if (Options.mergeGraphs.value && this == gcallee) {
        if (p.isReturn()) w.addFirst(new UnifyConstraint(nodeR, nodeL));
        else w.addFirst(new UnifyConstraint(nodeL, nodeR));
      }
      callsites.add(call);
      callees.add(callee);
      gcallee.callers.add(method);
      gcallee.w.add(new CallConstraint(nodeR, nodeL, call));
    }

    if (f != null) setTouched(x);
  }
Esempio n. 5
0
 protected void setGlobal(Var v) {
   Node node = getNode(v, null);
   assert (!v.isLocal() || v.isException());
   node.isheap = true;
 }