Altered ownership graph to dot file by removing label nodes, marking allocation
authorjjenista <jjenista>
Mon, 31 Mar 2008 20:47:54 +0000 (20:47 +0000)
committerjjenista <jjenista>
Mon, 31 Mar 2008 20:47:54 +0000 (20:47 +0000)
site nodes with the object type, numbering heap regions allocated for a parameter
by the parameter index and tested that initial parameter relfexive edges get
clobbered by code that introduces a self-reference.

Robust/src/Analysis/OwnershipAnalysis/AllocationSite.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Tests/OwnershipAnalysisTest/test01/MAKESURETOTESTTHIS [deleted file]
Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java
Robust/src/Tests/OwnershipAnalysisTest/test02/test02.java

index c98b6500cd60c5c9447377dc5486ce8e9f4c3b6f..469fc425059ff8ff70bc19ab11a2048ddb4b7d9d 100644 (file)
@@ -27,12 +27,14 @@ public class AllocationSite {
     protected int             allocationDepth;
     protected Vector<Integer> ithOldest;
     protected Integer         summary;
+    protected TypeDescriptor  type;
 
 
-    public AllocationSite( int allocationDepth ) {
+    public AllocationSite( int allocationDepth, TypeDescriptor type ) {
        assert allocationDepth >= 3;
 
        this.allocationDepth = allocationDepth; 
+       this.type            = type;
 
        ithOldest = new Vector<Integer>( allocationDepth );
        id        = generateUniqueAllocationSiteID();
@@ -72,7 +74,11 @@ public class AllocationSite {
        return summary;
     }
 
+    public TypeDescriptor getType() {
+       return type;
+    }
+
     public String toString() {
-       return "allocSite" + id;
+       return "allocSite" + id + "\\n" + type;
     }
 }
index 486645220e470ba89a96b7bd7f74b32ee3aa8ae1..894674ec8c3c05ecfe0fd021dafb298debbd8f8f 100644 (file)
@@ -379,7 +379,7 @@ public class OwnershipAnalysis {
     // return just the allocation site associated with one FlatNew node
     private AllocationSite getAllocationSiteFromFlatNew( FlatNew fn ) {
        if( !mapFlatNewToAllocationSite.containsKey( fn ) ) {
-           AllocationSite as = new AllocationSite( allocationDepth );
+           AllocationSite as = new AllocationSite( allocationDepth, fn.getType() );
 
            // the newest nodes are single objects
            for( int i = 0; i < allocationDepth; ++i ) {
index fc5cb76a998a2e11fc74e2d7e197cea22b1927a3..4e711b498c15cc1e9bc457d94188e7bf1441f52e 100644 (file)
@@ -230,7 +230,7 @@ public class OwnershipGraph {
                                                          false,
                                                          isTask,
                                                          false,
-                                                         "param" );
+                                                         "param" + paramIndex );
 
        // keep track of heap regions that were created for
        // parameter labels, the index of the parameter they
@@ -318,7 +318,7 @@ public class OwnershipGraph {
        if( hrnSummary == null ) {
            hrnSummary = createNewHeapRegionNode( idSummary,
                                                  false,
-                                                 false,
+                                                 as.getType().getClassDesc().hasFlags(),
                                                  true,
                                                  as + "\\nsummary" );
        }
@@ -332,7 +332,7 @@ public class OwnershipGraph {
        if( hrnK == null ) {
            hrnK = createNewHeapRegionNode( idK,
                                            true,
-                                           false,
+                                           as.getType().getClassDesc().hasFlags(),
                                            false,
                                            as + "\\noldest" );
        }
@@ -395,14 +395,14 @@ public class OwnershipGraph {
            if( hrnI == null ) {
                hrnI = createNewHeapRegionNode( idIth,
                                                true,
-                                               false,
+                                               as.getType().getClassDesc().hasFlags(),
                                                false,
                                                as + "\\n" + Integer.toString( i ) + "th" );
            }
            if( hrnImin1 == null ) {
                hrnImin1 = createNewHeapRegionNode( idImin1th,
                                                    true,
-                                                   false,
+                                                   as.getType().getClassDesc().hasFlags(),
                                                    false,
                                                    as + "\\n" + Integer.toString( i-1 ) + "th" );
            }
@@ -1087,16 +1087,19 @@ 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 ) {
+       LabelNode ln1 = getLabelNodeFromTemp( td1 );
+       LabelNode ln2 = getLabelNodeFromTemp( td2 );
+       
        
 
        return false;
     }
-    */
+   
 
 
     // for writing ownership graphs to dot files
@@ -1139,6 +1142,7 @@ public class OwnershipGraph {
        }
 
        // then visit every label node
+       /*
        s = td2ln.entrySet();
        i = s.iterator();
        while( i.hasNext() ) {
@@ -1162,6 +1166,7 @@ public class OwnershipGraph {
                          "\"];\n" );
            }
        }
+       */
 
        bw.write( "}\n" );
        bw.close();
diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/MAKESURETOTESTTHIS b/Robust/src/Tests/OwnershipAnalysisTest/test01/MAKESURETOTESTTHIS
deleted file mode 100644 (file)
index 2fb91b1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Make sure to test that an initial parameter has a special reflexive edge, but if you
-actually remake that edge during the method analysis, it becomes a regular edge and
-then will get picked up by the method call resolution!
index 483c3e31950b3e2d42f938319a096631af92e815..26050fc7c51ab6468bd73bd9f66760f63e2fd41b 100644 (file)
@@ -1,4 +1,4 @@
-/*
+
 public class Parameter {
     flag w;
     int a, b;
@@ -18,23 +18,22 @@ public class Penguin {
 
     public void bar() { x = 1; }
 }
-*/
 
-/*
 public class Voo {
-    flag f; int x; Baw b;
+    flag f; int x; Baw b; Baw bb;
 
     public Voo() {}
 }
 
 public class Baw {
     flag g; int y;
+    Foo f;
 
     public Baw() {}
 
     public void doTheBaw( Voo v ) { v = new Voo(); }
 }
-*/
+
 
 public class Foo {
     public Foo() {}
@@ -65,7 +64,7 @@ task Startup( StartupObject s{ initialstate } ) {
 // be a heap region for the parameter, and several
 // heap regions for the allocation site, but the label
 // merely points to the newest region
-/*
+
 task NewObject( Voo v{ f } ) {
     Voo w = new Voo();
     Baw b = new Baw();
@@ -90,13 +89,20 @@ task Branch( Voo v{ f } ) {
 }
 
 
-task NewInLoop( Voo v{ f } ) {
+task NoAliasNewInLoop( Voo v{ f } ) {
     Voo w = new Voo();
 
     for( int i = 0; i < 10; ++i ) {
        w.b = new Baw();
+       w.b.f = new Foo();
     }
 
     taskexit( v{ !f } );
 }
-*/
+
+
+task ClobberInitParamReflex( Voo v{ f }, Voo w{ f } ) {
+    v.b = v.bb;
+
+    taskexit( v{ !f }, w{ !f } );
+}
\ No newline at end of file
index 1e03e52cbf3aebf706f19fdf09824b633e662e57..118668d2f35ab5f0307552cbbc8b9753a07c1922 100644 (file)
@@ -41,7 +41,7 @@ task Startup( StartupObject s{ initialstate } ) {
     taskexit( s{ !initialstate } );
 }
 
-/*
+
 task aliasFromObjectAssignment
     ( Parameter p1{!w}, Parameter p2{!w} ) {
     
@@ -103,9 +103,7 @@ task possibleAliasConditional
 
     taskexit( p1{w}, p2{w} );
 }
-*/
 
-/*
 task bunchOfPaths
     ( Parameter p1{!w}, Parameter p2{!w} ) {
 
@@ -138,9 +136,7 @@ task bunchOfPaths
 
     taskexit( p1{w}, p2{w} );
 }
-*/
 
-/*
 task literalTest( Parameter p1{!w} ) {
     Parameter x = null;
     int y = 5;
@@ -177,4 +173,3 @@ task newPossibleAlias
 
     taskexit( p1{w}, p2{w} );
 }
-*/
\ No newline at end of file