Capture stable point.
authorjjenista <jjenista>
Fri, 22 Feb 2008 00:15:12 +0000 (00:15 +0000)
committerjjenista <jjenista>
Fri, 22 Feb 2008 00:15:12 +0000 (00:15 +0000)
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Tests/OwnershipAnalysisTest/test01/makefile
Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java

index d9d362cffd76aa5af73381d5b21f23fda2ff3b8d..86eafa5dd4470adec4c1a82fadfd725cfef04eb7 100644 (file)
@@ -50,12 +50,12 @@ public class OwnershipAnalysis {
        mapDescriptorToCompleteOwnershipGraph =
            new Hashtable<Descriptor, OwnershipGraph>();
 
-       // initialize methods to visit as the set of
-       // all tasks
+       // initialize methods to visit as the set of all tasks
        descriptorsToVisit = new HashSet<Descriptor>();
        Iterator taskItr = state.getTaskSymbolTable().getDescriptorsIterator();
        while( taskItr.hasNext() ) {
-           descriptorsToVisit.add( (Descriptor) taskItr.next() );
+           Descriptor d = (Descriptor) taskItr.next();
+           descriptorsToVisit.add( d );
        }       
        
        // as mentioned above, analyze methods one-by-one, possibly revisiting
@@ -64,6 +64,38 @@ public class OwnershipAnalysis {
     }
 
     private void analyzeMethods() throws java.io.IOException {
+       
+       while( !descriptorsToVisit.isEmpty() ) {
+           Descriptor d = (Descriptor) descriptorsToVisit.iterator().next();
+           descriptorsToVisit.remove( d );
+
+           System.out.println( "Analyzing " + d );
+
+           // because the task or method descriptor just extracted
+           // in the "to visit" set it either hasn't been analyzed
+           // yet, or some method that it depends on has been
+           // updated.  Recompute a complete ownership graph for
+           // this task/method and compare it to any previous result.
+           // If there is a change detected, add any methods/tasks
+           // that depend on this one to the "to visit" set.
+           OwnershipGraph og = new OwnershipGraph( allocationDepth );
+
+           
+           OwnershipGraph ogPrev = mapDescriptorToCompleteOwnershipGraph.get( d );
+
+           if( !og.equals( ogPrev ) ) {
+
+               mapDescriptorToCompleteOwnershipGraph.put( d, og );
+
+               // only methods have dependents, tasks cannot
+               // be invoked by any user program calls
+               if( d instanceof MethodDescriptor ) {
+                   MethodDescriptor md = (MethodDescriptor) d;
+                   Set dependents = callGraph.getCallerSet( md );
+                   descriptorsToVisit.addAll( dependents );
+               }
+           }
+       }
 
 
        /*
index 069425ec0e34c5338bc175009dd45ec360f9ecda..b936ce21a5c8fb28459c67b91bc768275ff1bdeb 100644 (file)
@@ -25,9 +25,11 @@ public class OwnershipGraph {
 
     protected int newDepthK;
     public Hashtable<FlatNew, NewCluster> fn2nc;
-
+    */
 
     public OwnershipGraph( int newDepthK ) {
+
+       /*
        id2hrn    = new Hashtable<Integer, HeapRegionNode>();
        heapRoots = new Hashtable<Integer, HeapRegionNode>();
 
@@ -39,9 +41,11 @@ public class OwnershipGraph {
 
        this.newDepthK = newDepthK;
        fn2nc          = new Hashtable<FlatNew, NewCluster>();
+       */
     }
 
 
+    /*
     protected void addReferenceEdge( OwnershipNode  referencer,
                                     HeapRegionNode referencee,
                                     ReferenceEdgeProperties rep ) {
@@ -313,6 +317,11 @@ public class OwnershipGraph {
     ////////////////////////////////////////////////////
 
     public void merge( OwnershipGraph og ) {
+
+        if( og == null ) {
+         return;
+        }
+
        mergeOwnershipNodes ( og );
        mergeReferenceEdges ( og );
        mergeHeapRoots      ( og );
@@ -527,7 +536,7 @@ public class OwnershipGraph {
            }
        }
     }
-
+    */
 
 
     // it is necessary in the equals() member functions
@@ -541,7 +550,12 @@ public class OwnershipGraph {
     // are equally present is to iterate over both data
     // structures and compare against the other graph.
     public boolean equals( OwnershipGraph og ) {
+
+        if( og == null ) {
+         return false;
+        }
        
+       /*
        if( !areHeapRegionNodesEqual( og ) ) {
            return false;
        }
@@ -569,10 +583,12 @@ public class OwnershipGraph {
        if( !areNewClustersEqual( og ) ) {
            return false;
        }
+       */
 
        return true;
     }
 
+    /*
     protected boolean areHeapRegionNodesEqual( OwnershipGraph og ) {
        // check all nodes in A for presence in graph B
        Set      sA = og.id2hrn.entrySet();
index f2df2c136b6dd183e9a26de46dd43a1653ef1e3a..63f284cc0bd3a82bd58606d4dc8b591a6a6ac99d 100644 (file)
@@ -3,9 +3,10 @@ PROGRAM=test01
 SOURCE_FILES=test01.java
 
 BUILDSCRIPT=~/research/Robust/src/buildscript
-BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
+#BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
+BSFLAGS= -recover -ownership -enable-assertions
 
-all: $(PROGRAM).bin #view
+all: $(PROGRAM).bin
 
 view: PNGs
        eog *flatIRGraph*.png &
index 9910cd5ba0156d67462385f6dfd49e8721d810e7..b08e42112e273f4adfc8815880781342fc1a3d00 100644 (file)
@@ -5,6 +5,8 @@ public class Parameter {
     public Parameter() {
        a = 0; b = 0; f = null; g = null;
     }
+
+    public void foo() { a = 1; }
 }
 
 task Startup( StartupObject s{ initialstate } ) {
@@ -13,6 +15,12 @@ task Startup( StartupObject s{ initialstate } ) {
     taskexit( s{ !initialstate } );
 }
 
+task DoStuff( Parameter p{!w} ) {
+    p.foo();
+
+    taskexit( p{w} );
+}
+
 /*
 task aliasFromObjectAssignment
     ( Parameter p1{!w}, Parameter p2{!w} ) {
@@ -118,6 +126,7 @@ task literalTest( Parameter p1{!w} ) {
 }
 */
 
+/*
 task newNoAlias
     ( Parameter p1{!w}, Parameter p2{!w} ) {
 
@@ -146,3 +155,4 @@ task newPossibleAlias
 
     taskexit( p1{w}, p2{w} );
 }
+*/