Collect merge of FlatReturn ownership graphs for use in function call
authorjjenista <jjenista>
Fri, 21 Mar 2008 18:52:54 +0000 (18:52 +0000)
committerjjenista <jjenista>
Fri, 21 Mar 2008 18:52:54 +0000 (18:52 +0000)
application.

Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java

index a00b44d284ba52ebcdd6deb5ce72f0b4c449881f..685ac580277b0410b22cdff1af3e65cda35b0d60 100644 (file)
@@ -77,6 +77,8 @@ public class OwnershipAnalysis {
        analyzeMethods();
     }
 
+    // called from the constructor to help initialize the set
+    // of methods that needs to be analyzed by ownership analysis
     private void scheduleAllCallees( HashSet<Descriptor> calleesScheduled,
                                     Descriptor d ) {
        if( calleesScheduled.contains( d ) ) {
@@ -133,6 +135,8 @@ public class OwnershipAnalysis {
            if( !og.equals( ogPrev ) ) {
                mapDescriptorToCompleteOwnershipGraph.put( d, og );
 
+               og.writeGraph( d );
+
                // only methods have dependents, tasks cannot
                // be invoked by any user program calls
                if( d instanceof MethodDescriptor ) {
@@ -187,7 +191,10 @@ public class OwnershipAnalysis {
            // apply the analysis of the flat node to the
            // ownership graph made from the merge of the
            // parent graphs
-           analyzeFlatNode( mDesc, fn, og );
+           analyzeFlatNode( mDesc,
+                            fn, 
+                            returnNodesToCombineForCompleteOwnershipGraph,
+                            og );
            
            // if the results of the new graph are different from
            // the current graph at this node, replace the graph
@@ -220,9 +227,10 @@ public class OwnershipAnalysis {
 
 
     private void 
-       analyzeFlatNode( Descriptor     methodDesc,
-                        FlatNode       fn,
-                        OwnershipGraph og ) throws java.io.IOException {
+       analyzeFlatNode( Descriptor              methodDesc,
+                        FlatNode                fn,
+                        HashSet<FlatReturnNode> setRetNodes,
+                        OwnershipGraph          og ) throws java.io.IOException {
 
        TempDescriptor  src;
        TempDescriptor  dst;
@@ -243,7 +251,7 @@ public class OwnershipAnalysis {
                TempDescriptor tdParam = fm.getParameter( i );
                og.assignTempToParameterAllocation( methodDesc instanceof TaskDescriptor,
                                                    tdParam );
-               og.writeGraph( methodDesc, fn );
+               //og.writeGraph( methodDesc, fn );
            }
            break;
            
@@ -253,7 +261,7 @@ public class OwnershipAnalysis {
                src = fon.getLeft();
                dst = fon.getDest();
                og.assignTempToTemp( src, dst );
-               og.writeGraph( methodDesc, fn );
+               //og.writeGraph( methodDesc, fn );
            }
            break;
            
@@ -264,7 +272,7 @@ public class OwnershipAnalysis {
            fld = ffn.getField();
            if( !fld.getType().isPrimitive() ) {
                og.assignTempToField( src, dst, fld );
-               og.writeGraph( methodDesc, fn );
+               //og.writeGraph( methodDesc, fn );
            }
            break;
            
@@ -274,7 +282,7 @@ public class OwnershipAnalysis {
            dst = fsfn.getDst();
            fld = fsfn.getField();
            og.assignFieldToTemp( src, dst, fld );
-           og.writeGraph( methodDesc, fn );
+           //og.writeGraph( methodDesc, fn );
            break;
            
        case FKind.FlatNew:
@@ -293,11 +301,13 @@ public class OwnershipAnalysis {
            //MethodDescriptor md = fc.getMethod();
            //descriptorsToVisit.add( md );
            //System.out.println( "    Descs to visit: " + descriptorsToVisit );
-           og.writeGraph( methodDesc, fn );
+           //og.writeGraph( methodDesc, fn );
            break;
 
        case FKind.FlatReturnNode:
-           og.writeGraph( methodDesc, fn );
+           FlatReturnNode frn = (FlatReturnNode) fn;
+           setRetNodes.add( frn );
+           //og.writeGraph( methodDesc, fn );
            break;
        }
     }
index dd841365e869605703ed61e2d3d988166d747534..ba53898e56fb7e68440328260bd2aba40f043ef6 100644 (file)
@@ -875,15 +875,37 @@ public class OwnershipGraph {
     }
 
 
+    /*
+    // use this method to determine if two temp descriptors can possibly
+    // access the same heap regions, which means there is a possible alias
+    public boolean havePossibleAlias( TempDescriptor td1,
+                                     TempDescriptor td2 ) {
+       
+
+       return false;
+    }
+    */
+
+
     // for writing ownership graphs to dot files
     public void writeGraph( Descriptor methodDesc,
                            FlatNode   fn ) throws java.io.IOException {
-       
-       String graphName =
-           methodDesc.getSymbol() +
-           methodDesc.getNum() +
-           fn.toString();
+       writeGraph(
+                  methodDesc.getSymbol() +
+                  methodDesc.getNum() +
+                  fn.toString()
+                  );
+    }
+
+    public void writeGraph( Descriptor methodDesc ) throws java.io.IOException {
+       writeGraph( 
+                  methodDesc.getSymbol() +
+                  methodDesc.getNum() +
+                  "COMPLETE"
+                   );
+    }
 
+    private void writeGraph( String graphName ) throws java.io.IOException {
        // remove all non-word characters from the graph name so
        // the filename and identifier in dot don't cause errors
        graphName = graphName.replaceAll( "[\\W]", "" );
index dbe9ed9d2e893b7677c881fe77e005483de2fc88..541f8dba3e53c6ed88943e484f8b91d552b735ac 100644 (file)
@@ -30,6 +30,8 @@ public class Baw {
     flag g; int y;
 
     public Baw() {}
+
+    public void doTheBaw( Voo v ) { v = new Voo(); }
 }
 
 
@@ -47,6 +49,8 @@ task Startup( StartupObject s{ initialstate } ) {
 // merely points to the newest region
 task NewObject( Voo v{ f } ) {
     Voo w = new Voo();
+    Baw b = new Baw();
+    b.doTheBaw( w );
 
     taskexit( v{ !f } );
 }