added ownership options
authorjjenista <jjenista>
Wed, 3 Sep 2008 23:44:37 +0000 (23:44 +0000)
committerjjenista <jjenista>
Wed, 3 Sep 2008 23:44:37 +0000 (23:44 +0000)
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/IR/State.java
Robust/src/Main/Main.java
Robust/src/Runtime/multicoretask.c
Robust/src/Runtime/task.c

index 1c3707df48a72e414651452edf029d9d593135b4..05a219761209fc191033de162298554b32058364 100644 (file)
@@ -203,8 +203,8 @@ public class OwnershipAnalysis {
                                                                  null,
                                                                  false);
   // for controlling DOT file output
-  private boolean writeFinalGraphs;
-  private boolean writeAllUpdates;
+  private boolean writeDOTs;
+  private boolean writeAllDOTs;
 
 
 
@@ -214,15 +214,16 @@ public class OwnershipAnalysis {
                            TypeUtil tu,
                            CallGraph callGraph,
                            int allocationDepth,
-                           boolean writeFinalGraphs,
-                           boolean writeAllUpdates) throws java.io.IOException {
+                           boolean writeDOTs,
+                           boolean writeAllDOTs,
+                           String aliasFile) throws java.io.IOException {
 
-    this.state            = state;
-    this.typeUtil         = tu;
-    this.callGraph        = callGraph;
-    this.allocationDepth  = allocationDepth;
-    this.writeFinalGraphs = writeFinalGraphs;
-    this.writeAllUpdates  = writeAllUpdates;
+    this.state           = state;
+    this.typeUtil        = tu;
+    this.callGraph       = callGraph;
+    this.allocationDepth = allocationDepth;
+    this.writeDOTs       = writeDOTs;
+    this.writeAllDOTs    = writeAllDOTs;
 
     descriptorsToAnalyze = new HashSet<Descriptor>();
 
@@ -238,7 +239,7 @@ public class OwnershipAnalysis {
     mapDescriptorToAllocationSiteSet =
       new Hashtable<Descriptor, HashSet<AllocationSite> >();
 
-    if( writeAllUpdates ) {
+    if( writeAllDOTs ) {
       mapDescriptorToNumUpdates = new Hashtable<Descriptor, Integer>();
     }
 
@@ -279,7 +280,11 @@ public class OwnershipAnalysis {
     // a method if the methods that it calls are updated
     analyzeMethods();
 
-    writeAllAliases("identifiedAliases.txt");
+    System.out.println("");
+
+    if( aliasFile != null ) {
+      writeAllAliases(aliasFile);
+    }
   }
 
   // called from the constructor to help initialize the set
@@ -613,9 +618,9 @@ public class OwnershipAnalysis {
     // boolean pruneGarbage,
     // boolean writeReferencers
 
-    if( writeFinalGraphs ) {
+    if( writeDOTs ) {
 
-      if( !writeAllUpdates ) {
+      if( !writeAllDOTs ) {
        og.writeGraph(d, true, true, true, false);
 
       } else {
index c700c7ffb4d7e6a994eacb18d31abad8a5cf765f..aed4c2d55c38d986a1f41eb542eee39bfb8da0f7 100644 (file)
@@ -54,6 +54,10 @@ public class State {
   public boolean FLATIRGRAPHLIBMETHODS=false;
   public boolean MULTICORE=false;
   public boolean OWNERSHIP=false;
+  public int OWNERSHIPALLOCDEPTH=3;
+  public boolean OWNERSHIPWRITEDOTS=false;
+  public boolean OWNERSHIPWRITEALL=false;
+  public String OWNERSHIPALIASFILE=null;
   public boolean OPTIONAL=false;
   public boolean RAW=false;
   public boolean SCHEDULING=false;
index 6620e41bb5ee450046d04b345fbac8b09722ef47..05e5c99c890a7ba741163cd06684401761e35f6d 100644 (file)
@@ -96,6 +96,15 @@ public class Main {
        state.MULTICORE=true;
       else if (option.equals("-ownership"))
        state.OWNERSHIP=true;
+      else if (option.equals("-ownallocdepth")) {
+       state.OWNERSHIPALLOCDEPTH=Integer.parseInt(args[++i]);
+      } else if (option.equals("-ownwritedots")) {
+       state.OWNERSHIPWRITEDOTS=true;
+       if (args[++i].equals("all")) {
+         state.OWNERSHIPWRITEALL=true;
+       }
+      } else if (option.equals("-ownaliasfile"))
+       state.OWNERSHIPALIASFILE=args[++i];
       else if (option.equals("-optional"))
        state.OPTIONAL=true;
       else if (option.equals("-raw"))
@@ -130,6 +139,9 @@ public class Main {
        System.out.println("-flatirlibmethods -- create dot files for flat IR graphs of library class methods");
        System.out.println("  note: -flatirusermethods or -flatirlibmethods currently generate all class method flat IR graphs");
        System.out.println("-ownership -- do ownership analysis");
+       System.out.println("-ownallocdepth <d> -- set allocation depth for ownership analysis");
+       System.out.println("-ownwritedots <all/final> -- write ownership graphs; can be all results or just final results");
+       System.out.println("-ownaliasfile <filename> -- write a text file showing all detected aliases in program tasks");
        System.out.println("-optional -- enable optional arguments");
        System.out.println("-webinterface -- enable web interface");
        System.out.println("-help -- print out help");
@@ -450,11 +462,14 @@ public class Main {
     }
 
     if (state.OWNERSHIP) {
-      CallGraph callGraph  = new CallGraph(state);
-      int allocationDepth  = 3;
-      OwnershipAnalysis oa =
-        new OwnershipAnalysis(state, tu, callGraph, allocationDepth, true, false);
-      //         oa.writeAllAliases( "identifiedAliases.txt" );
+      CallGraph callGraph = new CallGraph(state);
+      OwnershipAnalysis oa = new OwnershipAnalysis(state,
+                                                   tu,
+                                                   callGraph,
+                                                   state.OWNERSHIPALLOCDEPTH,
+                                                   state.OWNERSHIPWRITEDOTS,
+                                                   state.OWNERSHIPWRITEALL,
+                                                   state.OWNERSHIPALIASFILE);
     }
 
     System.exit(0);
index df46769637ca5676e3b04ed6cb1c18b514eb5a98..5bee1d1832b06fafc510e977f4d3d9b2b02b04e9 100644 (file)
@@ -3404,7 +3404,7 @@ parameterpresent:
             }*/
          /* Actually call task */
 #ifdef PRECISE_GC
-                                                         ((int *)taskpointerarray)[0]=currtpd->numParameters;
+                                                               ((int *)taskpointerarray)[0]=currtpd->numParameters;
          taskpointerarray[1]=NULL;
 #endif
 execute:
index e54771326866aab84e62357590644a3647472adf..fc2ad5fd02c2ffab2c23d89b8236f13a41b252aa 100644 (file)
@@ -1200,7 +1200,7 @@ parameterpresent:
          }
          /* Actually call task */
 #ifdef PRECISE_GC
-                                                         ((int *)taskpointerarray)[0]=currtpd->numParameters;
+                                                               ((int *)taskpointerarray)[0]=currtpd->numParameters;
          taskpointerarray[1]=NULL;
 #endif
 #ifdef OPTIONAL