Capture stable state.
authorjjenista <jjenista>
Mon, 3 Mar 2008 23:55:53 +0000 (23:55 +0000)
committerjjenista <jjenista>
Mon, 3 Mar 2008 23:55:53 +0000 (23:55 +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 81ae21c012d272875f1e7d9c392f9bf8fb4d73b5..e045c8caa75c9b2970e9509105be4fed68768845 100644 (file)
@@ -117,15 +117,15 @@ public class OwnershipAnalysis {
            boolean    isTask;
            FlatMethod fm;
            if( d instanceof MethodDescriptor ) {
-               isTask = false;
+               //isTask = false;
                fm     = state.getMethodFlat( (MethodDescriptor) d );
            } else {
                assert d instanceof TaskDescriptor;
-               isTask = true;
+               //isTask = true;
                fm     = state.getMethodFlat( (TaskDescriptor) d );
            }
            
-           OwnershipGraph og     = analyzeFlatMethod( isTask, fm );
+           OwnershipGraph og     = analyzeFlatMethod( d, fm );
            OwnershipGraph ogPrev = mapDescriptorToCompleteOwnershipGraph.get( d );
 
            if( !og.equals( ogPrev ) ) {
@@ -146,8 +146,10 @@ public class OwnershipAnalysis {
     }
 
 
+    // keep passing the Descriptor of the method along for debugging
+    // and dot file writing
     private OwnershipGraph
-       analyzeFlatMethod( boolean    isTask,
+       analyzeFlatMethod( Descriptor mDesc,
                           FlatMethod flatm ) throws java.io.IOException {
 
        // initialize flat nodes to visit as the flat method
@@ -183,7 +185,7 @@ public class OwnershipAnalysis {
            // apply the analysis of the flat node to the
            // ownership graph made from the merge of the
            // parent graphs
-           analyzeFlatNode( isTask, fn, og );
+           analyzeFlatNode( mDesc, fn, og );
            
            // if the results of the new graph are different from
            // the current graph at this node, replace the graph
@@ -216,7 +218,7 @@ public class OwnershipAnalysis {
 
 
     private void 
-       analyzeFlatNode( boolean        isTask,
+       analyzeFlatNode( Descriptor     methodDesc,
                         FlatNode       fn,
                         OwnershipGraph og ) throws java.io.IOException {
 
@@ -241,20 +243,19 @@ public class OwnershipAnalysis {
            // adding parameters labels to new heap regions
            for( int i = 0; i < fm.numParameters(); ++i ) {
                TempDescriptor tdParam = fm.getParameter( i );          
-               og.parameterAllocation( isTask, tdParam );
+               og.parameterAllocation( methodDesc instanceof TaskDescriptor,
+                                       tdParam );
+               og.writeGraph( methodDesc, fn );
            }
            break;
            
-           /*
        case FKind.FlatOpNode:
            FlatOpNode fon = (FlatOpNode) fn;
            if( fon.getOp().getOp() == Operation.ASSIGN ) {
                src = fon.getLeft();
                dst = fon.getDest();
                og.assignTempToTemp( src, dst );
-               //nodeDescription = "Op";
-               //writeGraph = true;
-               og.writeGraph( fn );
+               og.writeGraph( methodDesc, fn );
            }
            break;
            
@@ -265,9 +266,7 @@ public class OwnershipAnalysis {
            fld = ffn.getField();
            if( !fld.getType().isPrimitive() ) {
                og.assignTempToField( src, dst, fld );
-               //nodeDescription = "Field";
-               //writeGraph = true;
-               og.writeGraph( fn );
+               og.writeGraph( methodDesc, fn );
            }
            break;
            
@@ -277,11 +276,10 @@ public class OwnershipAnalysis {
            dst = fsfn.getDst();
            fld = fsfn.getField();
            og.assignFieldToTemp( src, dst, fld );
-           //nodeDescription = "SetField";
-           //writeGraph = true;
-           og.writeGraph( fn );
+           og.writeGraph( methodDesc, fn );
            break;
            
+           /*
        case FKind.FlatNew:
            FlatNew fnn = (FlatNew) fn;
            dst = fnn.getDst();
@@ -304,23 +302,16 @@ public class OwnershipAnalysis {
            //MethodDescriptor md = fc.getMethod();
            //descriptorsToVisit.add( md );
            //System.out.println( "    Descs to visit: " + descriptorsToVisit );
+           og.writeGraph( methodDesc, fn );
            break;
 
        case FKind.FlatReturnNode:
            //nodeDescription = "Return";
            //writeGraph = true;
            //og.writeCondensedAnalysis( makeCondensedAnalysisName( methodname, flatnodetolabel.get(fn) ) );
-           //og.writeGraph( fn );
+           og.writeGraph( methodDesc, fn );
            break;
        }
-       
-       /*
-       if( writeGraph ) {
-           og.writeGraph( makeNodeName( methodname, 
-                                        flatnodetolabel.get( fn ), 
-                                        nodeDescription ) );
-       }
-       */
     }
 
     static public Integer generateUniqueHeapRegionNodeID() {
index 63e839802b7230c49b507a682dbed82455cdac24..2b10d55367c4e24ab426629314b8e2d62c2d9a0c 100644 (file)
@@ -7,10 +7,10 @@ import java.io.*;
 
 public class OwnershipGraph {
 
-    /*
+
     protected static final int VISIT_HRN_WRITE_FULL      = 0;
-    protected static final int VISIT_HRN_WRITE_CONDENSED = 1;
-    */
+    //protected static final int VISIT_HRN_WRITE_CONDENSED = 1;
+
 
     private int allocationDepth;
 
@@ -98,7 +98,6 @@ public class OwnershipGraph {
     }
     
 
-    /*
     ////////////////////////////////////////////////////
     //
     //  New Reference Methods
@@ -180,7 +179,6 @@ public class OwnershipGraph {
     // end new reference methods
     ////////////////////////////////////////////////////
 
-    */
 
     protected HeapRegionNode 
        createNewHeapRegionNode( Integer id,
@@ -918,8 +916,19 @@ public class OwnershipGraph {
     }
     */
 
-    public void writeGraph( String graphName ) throws java.io.IOException {
+    public void writeGraph( Descriptor methodDesc,
+                           FlatNode   fn ) throws java.io.IOException {
        
+       String graphName =
+           methodDesc.getSymbol() +
+           methodDesc.getNum() +
+           fn.toString();
+
+       // remove all non-word characters from the graph name so
+       // the filename and identifier in dot don't cause errors
+       graphName = graphName.replaceAll( "[\\W]", "" );
+
+
        BufferedWriter bw = new BufferedWriter( new FileWriter( graphName+".dot" ) );
        bw.write( "digraph "+graphName+" {\n" );
 
@@ -945,12 +954,14 @@ public class OwnershipGraph {
 
            bw.write( "  }\n" );
        }
+       */
+
 
        // then visit every heap region node
        HashSet<HeapRegionNode> visited = new HashSet<HeapRegionNode>();
 
-       s = heapRoots.entrySet();
-       i = s.iterator();
+       Set      s = heapRoots.entrySet();
+       Iterator i = s.iterator();
        while( i.hasNext() ) {
            Map.Entry      me  = (Map.Entry)      i.next();
            HeapRegionNode hrn = (HeapRegionNode) me.getValue();
@@ -981,7 +992,6 @@ public class OwnershipGraph {
                          "\"];\n" );
            }
        }
-       */
 
        bw.write( "}\n" );
        bw.close();
@@ -1025,6 +1035,7 @@ public class OwnershipGraph {
        bw.write( "}\n" );
        bw.close();
     }
+    */
 
     protected void traverseHeapRegionNodes( int mode,
                                            HeapRegionNode hrn,
@@ -1063,6 +1074,7 @@ public class OwnershipGraph {
                       "\"];\n" );
            break;
 
+           /*
        case VISIT_HRN_WRITE_CONDENSED:     
 
            Iterator i = hrn.iteratorToAnalysisRegionAliases();
@@ -1089,11 +1101,11 @@ public class OwnershipGraph {
 
            hrn.addAnalysisRegionAlias( td );
            break;
+           */
        }
 
-
-       OwnershipNode onRef = null;
-       Iterator refItr = hrn.iteratorToReferencers();
+       OwnershipNode onRef  = null;
+       Iterator      refItr = hrn.iteratorToReferencers();
        while( refItr.hasNext() ) {
            onRef = (OwnershipNode) refItr.next();
 
@@ -1130,6 +1142,4 @@ public class OwnershipGraph {
            traverseHeapRegionNodes( mode, hrnChild, bw, td, visited );
        }
     }
-    */
-
 }
index 63f284cc0bd3a82bd58606d4dc8b591a6a6ac99d..bf640f776e569e812668ecc88a16274e45655695 100644 (file)
@@ -3,22 +3,23 @@ PROGRAM=test01
 SOURCE_FILES=test01.java
 
 BUILDSCRIPT=~/research/Robust/src/buildscript
-#BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
-BSFLAGS= -recover -ownership -enable-assertions
+BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
+#BSFLAGS= -recover -ownership -enable-assertions
 
 all: $(PROGRAM).bin
 
 view: PNGs
-       eog *flatIRGraph*.png &
-       eog *FN*.png &
-       eog *Ownership*.png &
+       #eog *flatIRGraph*.png &
+       #eog *FN*.png &
+       #eog *Ownership*.png &
+       eog *.png &
 
 PNGs: DOTs
-       rm -f *Startup*.dot
-       rm -f *FN*Method*.dot
-       rm -f *FN*Op*.dot
-       rm -f *FN*Field*.dot
-       rm -f *FN*SetField*.dot
+       #rm -f *Startup*.dot
+       rm -f *FlatMethod*.dot
+       rm -f *FlatOpNode*.dot
+       rm -f *FlatFieldNode*.dot
+       rm -f *FlatSetFieldNode*.dot
        d2p *.dot
 
 DOTs: $(PROGRAM).bin
index 8bac13c23c63fb728143a76b56ca033af2a5991f..fe8258fa5dc2988a1cde79c87043dcbe4c0eab38 100644 (file)
@@ -2,19 +2,29 @@ public class Parameter {
     flag w;
     int a, b;
     Parameter f, g;
-    public Parameter() {
-       a = 0; b = 0; f = null; g = null;
-    }
+
+    public Parameter() { a = 0; b = 0; f = null; g = null; }
 
     public void bar() { foo(); }
     public void foo() { bar(); }
 }
 
+public class Penguin {
+    int x, y;
+
+    public Penguin() { x = 0; y = 0; }
+
+    public void bar() { x = 1; }
+}
+
 task Startup( StartupObject s{ initialstate } ) {
 
     Parameter p = new Parameter(){!w};
     p.foo();
 
+    Penguin g = new Penguin();
+    g.bar();
+
     taskexit( s{ !initialstate } );
 }
 
@@ -80,7 +90,7 @@ task possibleAliasConditional
 
     taskexit( p1{w}, p2{w} );
 }
-
+*/
 task bunchOfPaths
     ( Parameter p1{!w}, Parameter p2{!w} ) {
 
@@ -113,7 +123,7 @@ task bunchOfPaths
 
     taskexit( p1{w}, p2{w} );
 }
-
+/*
 task literalTest( Parameter p1{!w} ) {
     Parameter x = null;
     int y = 5;
@@ -121,9 +131,7 @@ task literalTest( Parameter p1{!w} ) {
 
     taskexit( p1{w} );
 }
-*/
 
-/*
 task newNoAlias
     ( Parameter p1{!w}, Parameter p2{!w} ) {
 
@@ -152,4 +160,4 @@ task newPossibleAlias
 
     taskexit( p1{w}, p2{w} );
 }
-*/
+*/
\ No newline at end of file