edge matching bug fix and add alpha source states back
authorjjenista <jjenista>
Tue, 24 Mar 2009 05:39:27 +0000 (05:39 +0000)
committerjjenista <jjenista>
Tue, 24 Mar 2009 05:39:27 +0000 (05:39 +0000)
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Tests/OwnershipAnalysisTest/test07/test.java

index 3605309b4c366e50aabf8a015c364b910af04b9f..e7128a888328266319c0d781e1db1967f5fbbcac 100644 (file)
@@ -1229,7 +1229,7 @@ public class OwnershipAnalysis {
   // insert a call to debugSnapshot() somewhere in the analysis 
   // to get successive captures of the analysis state
   boolean takeDebugSnapshots = false;
-  String mcDescSymbolDebug = "StandardEngine";
+  String mcDescSymbolDebug = "addFirst";
   boolean stopAfterCapture = true;
 
   // increments every visit to debugSnapshot, don't fiddle with it
@@ -1246,7 +1246,7 @@ public class OwnershipAnalysis {
   int iterStartCapture = 0;
 
   // the number of snapshots to take
-  int numIterToCapture = 100;
+  int numIterToCapture = 40;
 
   void debugSnapshot(OwnershipGraph og, FlatNode fn) {
     if( debugCounter > iterStartCapture + numIterToCapture ) {
@@ -1266,6 +1266,14 @@ public class OwnershipAnalysis {
        graphName = graphName+fn;
       }
       try {
+       // arguments to writeGraph are:
+       // boolean writeLabels,
+       // boolean labelSelect,
+       // boolean pruneGarbage,
+       // boolean writeReferencers
+       // boolean writeParamMappings
+
+       //og.writeGraph(graphName, true, true, true, false, false);
        og.writeGraph(graphName, true, true, true, false, false);
       } catch( Exception e ) {
        System.out.println("Error writing debug capture.");
index 96d20cc3cca2f4280eb935436c61c6a4d47934ef..58c38d0efe776181c3bf3d2f72d5d783e7ad509c 100644 (file)
@@ -231,8 +231,9 @@ public class OwnershipGraph {
       ReferenceEdge edge = i.next();
 
       if( removeAll                                          || 
-         (type  != null && edge.getType() .equals( type  )) ||
-         (field != null && edge.getField().equals( field ))   
+         (edge.typeEquals( type ) && edge.fieldEquals( field ))
+         //(type  != null && edge.getType() .equals( type  )) ||
+         //(field != null && edge.getField().equals( field ))   
         ){
 
        HeapRegionNode referencee = edge.getDst();
@@ -259,8 +260,9 @@ public class OwnershipGraph {
       ReferenceEdge edge = i.next();
 
       if( removeAll                                          || 
-         (type  != null && edge.getType() .equals( type  )) ||
-         (field != null && edge.getField().equals( field ))   
+         (edge.typeEquals( type ) && edge.fieldEquals( field ))
+         //(type  != null && edge.getType() .equals( type  )) ||
+         //(field != null && edge.getField().equals( field ))   
         ){
 
        OwnershipNode referencer = edge.getSrc();
@@ -379,6 +381,11 @@ public class OwnershipGraph {
     HashSet<HeapRegionNode> nodesWithNewAlpha = new HashSet<HeapRegionNode>();
     HashSet<ReferenceEdge>  edgesWithNewBeta  = new HashSet<ReferenceEdge>();
 
+
+    
+    //boolean printDebug = f.getType()    
+
+
     // first look for possible strong updates and remove those edges
     boolean strongUpdate = false;
 
@@ -1540,7 +1547,7 @@ public class OwnershipGraph {
       HeapRegionNode n  = (HeapRegionNode) me.getKey();
       ChangeTupleSet C  = (ChangeTupleSet) me.getValue();
 
-      n.setAlphaNew( n.getAlpha().applyChangeSet( C, false ) );
+      n.setAlphaNew( n.getAlpha().applyChangeSet( C, true ) );
       nodesWithNewAlpha.add( n );
     }
 
@@ -1840,12 +1847,17 @@ public class OwnershipGraph {
 
     String debugCaller = "foo";
     String debugCallee = "bar";
+    //String debugCaller = "StandardEngine";
+    //String debugCaller = "register_by_type";
+    //String debugCaller = "register_by_type_front";
+    //String debugCaller = "addFirst";
+    //String debugCallee = "LinkedListElement";
 
     if( mc.getDescriptor().getSymbol().equals( debugCaller ) &&
        fm.getMethod().getSymbol().equals( debugCallee ) ) {
 
       try {
-       writeGraph( "debug1Before", true, true, true, false, false );
+       writeGraph( "debug1BeforeCall", true, true, true, false, false );
        ogCallee.writeGraph( "debug0Callee", true, true, true, false, false );
       } catch( IOException e ) {}
 
@@ -2833,6 +2845,15 @@ public class OwnershipGraph {
     }
 
 
+    if( mc.getDescriptor().getSymbol().equals( debugCaller ) &&
+       fm.getMethod().getSymbol().equals( debugCallee ) ) {
+      try {
+       writeGraph( "debug7JustBeforeMergeToKCapacity", true, true, true, false, false );
+      } catch( IOException e ) {}
+    }
+
+
+
     // merge the shadow nodes of allocation sites back down to normal capacity
     Iterator<AllocationSite> allocItr = ogCallee.allocationSites.iterator();
     while( allocItr.hasNext() ) {
@@ -2903,7 +2924,7 @@ public class OwnershipGraph {
     if( mc.getDescriptor().getSymbol().equals( debugCaller ) &&
        fm.getMethod().getSymbol().equals( debugCallee ) ) {
       try {
-       writeGraph( "debug2JustBeforeSweep", true, true, true, false, false );
+       writeGraph( "debug8JustBeforeSweep", true, true, true, false, false );
       } catch( IOException e ) {}
     }
 
@@ -2919,10 +2940,15 @@ public class OwnershipGraph {
        writeGraph( "debug9endResolveCall", true, true, true, false, false );
       } catch( IOException e ) {}
       System.out.println( "  "+mc+" done calling "+fm );      
-      System.exit( -1 );   
+      ++x;
+      if( x > 2 ) {
+       System.exit( -1 );   
+      }
     }
   }
 
+  static int x = 0;
+
 
   protected boolean hasMatchingField(HeapRegionNode src, ReferenceEdge edge) {
 
index 7090a143d8b571da2b38b15a265eb9e0330c15cc..c2e991873725a1895b3975f76d3dfcc12acad163 100644 (file)
@@ -1,27 +1,56 @@
-public class Foo {
-  public Foo() {}
+public class Engine {
+  LinkedList[] actions;
 
-  public Bar b;
-}
+  public Engine() {
+    actions = new LinkedList[10];
+    for( int i = 0; i < 10; ++i ) {
+      actions[i] = disjoint blah new LinkedList();
+    }
+  }
 
-public class Bar {
-  public Bar() {}  
+  public add( Action a, int list, Action c ) {
+    actions[list].addFirst( a );
+  }
 }
 
-public class Test {
+public class StandardEngine extends Engine {
+  public StandardEngine( Gen gen ) {
+    Engine();
 
-  static public void main( String[] args ) {
-    Foo x = disjoint foo new Foo();
-    Bar y = disjoint bar new Bar();
+    Action c = new Action( gen );
 
-    x.b = y;
+    Action a = new AntherAction( gen );
+    add( a, 0, c );
+    //add( a, 1, c  );
+
+    
+    Action b = new AntherAction( gen );    
+    add( b, 0, c );    
     
-    virginia( x, y );
   }
+}
 
-  static public void virginia( Foo x, Bar y ) {
-    //x.b = y;
-    //x.b = new Bar();
-    x.b = null;
+public class Action {
+  Gen gen;
+  public Action( Gen g ) {
+    gen = g;
+  }
+}
+
+public class AntherAction extends Action {
+  public AntherAction( Gen g ) {
+    Action( g );
+  }
+}
+
+public class Gen {
+  public Gen() {}
+}
+
+public class Test {
+
+  static public void main( String[] args ) {
+    Gen gen = new Gen();
+    StandardEngine se = new StandardEngine( gen );
   }
 }