disjointness for Java has all planned features
authorjjenista <jjenista>
Mon, 2 Feb 2009 20:54:28 +0000 (20:54 +0000)
committerjjenista <jjenista>
Mon, 2 Feb 2009 20:54:28 +0000 (20:54 +0000)
Robust/src/Analysis/OwnershipAnalysis/AllocationSite.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/IR/Flat/BuildFlat.java
Robust/src/IR/Flat/FlatNew.java
Robust/src/IR/Tree/BuildIR.java
Robust/src/IR/Tree/CreateObjectNode.java
Robust/src/Parse/java14.cup

index 7829ea112c8f33870fa902c8b961149e0f661806..9ccece7b02bbfda72f8cc7e06405950d6b2fa946 100644 (file)
@@ -28,7 +28,7 @@ public class AllocationSite {
   protected Vector<Integer> ithOldest;
   protected Integer summary;
   protected FlatNew flatNew;
-  protected boolean forceAnalyze;
+  protected String disjointId;
 
   public static final int AGE_notInThisSite = 100;
   public static final int AGE_in_I          = 101;
@@ -41,12 +41,12 @@ public class AllocationSite {
   public static final int SHADOWAGE_summary       = -103;
 
 
-  public AllocationSite(int allocationDepth, FlatNew flatNew, boolean forceAnalyze) {
+  public AllocationSite(int allocationDepth, FlatNew flatNew, String disjointId) {
     assert allocationDepth >= 1;
 
     this.allocationDepth = allocationDepth;
     this.flatNew         = flatNew;
-    this.forceAnalyze    = forceAnalyze;
+    this.disjointId      = disjointId;
 
     ithOldest = new Vector<Integer>(allocationDepth);
     id        = generateUniqueAllocationSiteID();
@@ -58,8 +58,8 @@ public class AllocationSite {
   }
 
 
-  public boolean doForceAnalyze() {
-    return forceAnalyze;
+  public String getDisjointId() {
+    return disjointId;
   }
 
 
@@ -182,4 +182,8 @@ public class AllocationSite {
   public String toStringVerbose() {
     return "allocSite" + id + " "+flatNew.getType().toPrettyString();
   }
+
+  public String toStringForDOT() {
+    return "disjoint "+disjointId+"\\n"+toString()+"\\n"+getType();
+  }
 }
index d79e9150afb319564733d4a54d4a3dd87d0f58f5..cc5b0a55be60f069e4af1b4482fd26816bd0f966 100644 (file)
@@ -823,7 +823,7 @@ public class OwnershipAnalysis {
   private AllocationSite getAllocationSiteFromFlatNewPRIVATE(FlatNew fn) {
 
     if( !mapFlatNewToAllocationSite.containsKey(fn) ) {
-      AllocationSite as = new AllocationSite(allocationDepth, fn, fn.isDisjoint());
+      AllocationSite as = new AllocationSite(allocationDepth, fn, fn.getDisjointId());
 
       // the newest nodes are single objects
       for( int i = 0; i < allocationDepth; ++i ) {
index 610ba4a6a48d69563befc87cf56ed24fd14a7c17..11a94138a92bcc1f34021fd2e7027281899ea0e6 100644 (file)
@@ -82,7 +82,7 @@ public class OwnershipGraph {
 
     boolean markForAnalysis = isFlagged || isParameter;
 
-    if( allocSite != null && allocSite.doForceAnalyze() ) {
+    if( allocSite != null && allocSite.getDisjointId() != null ) {
       markForAnalysis = true;
     }
 
@@ -868,7 +868,7 @@ public class OwnershipGraph {
                                            false,
                                            as,
                                            null,
-                                           as + "\\n" + as.getType() + "\\nsummary");
+                                           as.toStringForDOT() + "\\nsummary");
 
       for( int i = 0; i < as.getAllocationDepth(); ++i ) {
        Integer idIth = as.getIthOldest(i);
@@ -880,7 +880,7 @@ public class OwnershipGraph {
                                false,
                                as,
                                null,
-                               as + "\\n" + as.getType() + "\\n" + i + " oldest");
+                               as.toStringForDOT() + "\\n" + i + " oldest");
       }
     }
 
index 7b4edf85427bbd0532c490a126fda65f1d4255e0..9eec4e65b24a0aeb8e1e53b80e117e99aacde688 100644 (file)
@@ -212,7 +212,7 @@ public class BuildFlat {
   private NodePair flattenCreateObjectNode(CreateObjectNode con,TempDescriptor out_temp) {
     TypeDescriptor td=con.getType();
     if (!td.isArray()) {
-      FlatNew fn=new FlatNew(td, out_temp, con.isGlobal(), con.isDisjoint());
+      FlatNew fn=new FlatNew(td, out_temp, con.isGlobal(), con.getDisjointId());
       TempDescriptor[] temps=new TempDescriptor[con.numArgs()];
       FlatNode last=fn;
       // Build arguments
@@ -271,7 +271,7 @@ public class BuildFlat {
                             out_temp :
                             TempDescriptor.tempFactory("arg",en.getType());
       }
-      FlatNew fn=new FlatNew(td, out_temp, temps[0], con.isGlobal(), con.isDisjoint());
+      FlatNew fn=new FlatNew(td, out_temp, temps[0], con.isGlobal(), con.getDisjointId());
       last.addNext(fn);
       if (temps.length>1) {
        NodePair np=generateNewArrayLoop(temps, td.dereference(), out_temp, 0, con.isGlobal());
index 03f2892dabc253df97d65556c51317b3e83f6870..5061607590cb79fd37424fb3aa1236e958323218 100644 (file)
@@ -6,22 +6,22 @@ public class FlatNew extends FlatNode {
   TypeDescriptor type;
   TempDescriptor size;
   boolean isglobal;
-  boolean isdisjoint;
+  String disjointId;
 
   public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal) {
     this.type=type;
     this.dst=dst;
     this.size=null;
     this.isglobal=isglobal;
-    this.isdisjoint=false;
+    this.disjointId=null;
   }
 
-  public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal, boolean isdisjoint) {
+  public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal, String disjointId) {
     this.type=type;
     this.dst=dst;
     this.size=null;
     this.isglobal=isglobal;
-    this.isdisjoint=isdisjoint;
+    this.disjointId=disjointId;
   }
 
   public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal) {
@@ -29,23 +29,23 @@ public class FlatNew extends FlatNode {
     this.dst=dst;
     this.size=size;
     this.isglobal=isglobal;
-    this.isdisjoint=false;
+    this.disjointId=null;
   }
 
-  public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal, boolean isdisjoint) {
+  public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal, String disjointId) {
     this.type=type;
     this.dst=dst;
     this.size=size;
     this.isglobal=isglobal;
-    this.isdisjoint=isdisjoint;
+    this.disjointId=disjointId;
   }
 
   public boolean isGlobal() {
     return isglobal;
   }
 
-  public boolean isDisjoint() {
-    return isdisjoint;
+  public String getDisjointId() {
+    return disjointId;
   }
 
   public String toString() {
index 342fd89730246749d22ae2efb7c01c7922f28ec4..8e70258cc1f815d732168d49dbde91418fe47c7b 100644 (file)
@@ -398,8 +398,11 @@ public class BuildIR {
       TypeDescriptor td=parseTypeDescriptor(pn);
       Vector args=parseArgumentList(pn);
       boolean isglobal=pn.getChild("global")!=null;
-      boolean isdisjoint=pn.getChild("disjoint")!=null;
-      CreateObjectNode con=new CreateObjectNode(td, isglobal, isdisjoint);
+      String disjointId=null;
+      if( pn.getChild("disjoint") != null) {
+       disjointId = pn.getChild("disjoint").getTerminal();
+      }
+      CreateObjectNode con=new CreateObjectNode(td, isglobal, disjointId);
       for(int i=0; i<args.size(); i++) {
        con.addArgument((ExpressionNode)args.get(i));
       }
@@ -418,7 +421,10 @@ public class BuildIR {
     } else if (isNode(pn,"createarray")) {
       //System.out.println(pn.PPrint(3,true));
       boolean isglobal=pn.getChild("global")!=null;
-      boolean isdisjoint=pn.getChild("disjoint")!=null;
+      String disjointId=null;
+      if( pn.getChild("disjoint") != null) {
+       disjointId = pn.getChild("disjoint").getTerminal();
+      }
       TypeDescriptor td=parseTypeDescriptor(pn);
       Vector args=parseDimExprs(pn);
       int num=0;
@@ -426,7 +432,7 @@ public class BuildIR {
        num=((Integer)pn.getChild("dims_opt").getLiteral()).intValue();
       for(int i=0; i<(args.size()+num); i++)
        td=td.makeArray(state);
-      CreateObjectNode con=new CreateObjectNode(td, isglobal, isdisjoint);
+      CreateObjectNode con=new CreateObjectNode(td, isglobal, disjointId);
       for(int i=0; i<args.size(); i++) {
        con.addArgument((ExpressionNode)args.get(i));
       }
index 5379b6f50fa514a0d13bd431614200839d667fc0..dd1d57cac4954cbeb45ac514ba0d02a9690ca2d5 100644 (file)
@@ -9,21 +9,21 @@ public class CreateObjectNode extends ExpressionNode {
   MethodDescriptor md;
   FlagEffects fe;
   boolean isglobal;
-  boolean isdisjoint;  
+  String disjointId;
 
-  public CreateObjectNode(TypeDescriptor type, boolean isglobal, boolean isdisjoint) {
+  public CreateObjectNode(TypeDescriptor type, boolean isglobal, String disjointId) {
     td=type;
     argumentlist=new Vector();
     this.isglobal=isglobal;
-    this.isdisjoint=isdisjoint;
+    this.disjointId=disjointId;
   }
 
   public boolean isGlobal() {
     return isglobal;
   }
 
-  public boolean isDisjoint() {
-    return isdisjoint;
+  public String getDisjointId() {
+    return disjointId;
   }
 
   public void addFlagEffects(FlagEffects fe) {
index 0bbbe88ee885e5546db11d6d3583fc36d4b743e6..b4cbbec4ad56ca133303ec304ccde90d45a5e9c2 100644 (file)
@@ -1428,8 +1428,7 @@ class_instance_creation_expression ::=
                pn.addChild(type);
                pn.addChild(args);
                pn.addChild(feo);
-               pn.addChild("disjoint");
-               pn.addChild(id);
+               pn.addChild("disjoint").addChild(id);
                RESULT=pn;
        :}
        | NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE RBRACE LBRACE tag_list:tl RBRACE {: 
@@ -1526,8 +1525,7 @@ array_creation_uninit ::=
                pn.addChild(type);
                pn.addChild(dimexpr);
                pn.addChild("dims_opt").setLiteral(dims);
-               pn.addChild("disjoint");
-               pn.addChild(id);
+               pn.addChild("disjoint").addChild(id);
                RESULT=pn;
                :}
        |       GLOBAL NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {: 
@@ -1543,8 +1541,7 @@ array_creation_uninit ::=
                pn.addChild(type);
                pn.addChild(dimexpr);
                pn.addChild("dims_opt").setLiteral(dims);
-               pn.addChild("disjoint");
-               pn.addChild(id);
+               pn.addChild("disjoint").addChild(id);           
                RESULT=pn;
                :}
        ;