new test for paper example
authorjjenista <jjenista>
Fri, 17 Oct 2008 17:45:13 +0000 (17:45 +0000)
committerjjenista <jjenista>
Fri, 17 Oct 2008 17:45:13 +0000 (17:45 +0000)
Robust/src/Tests/OwnershipAnalysisTest/test03/test03.java
Robust/src/Tests/OwnershipAnalysisTest/test04/makefile [new file with mode: 0644]
Robust/src/Tests/OwnershipAnalysisTest/test04/test04.java [new file with mode: 0644]

index b59d683a418404a3224170fd47054cbfed54e9c2..8dbee93e4f646f04189907e8641aacfc5512ee22 100644 (file)
@@ -31,9 +31,18 @@ task Startup( StartupObject s{ initialstate } ) {
 
 task MakeGraph( Parameter p1{ !w } ) {
 
-  while( false ) {
-    Parameter p2 = new Parameter();
-    
+  Parameter pKeep0;
+  Parameter pKeep1;
+  Parameter pKeep2;
+  Parameter p2;
+
+  while( false ) {  
+    pKeep2 = pKeep1;
+    pKeep1 = pKeep0;
+    pKeep0 = p2;
+
+    p2 = new Parameter();    
+
     Node n1 = Node.makeNode();
     Node n2 = Node.makeNode();
     Node n3 = Node.makeNode();
diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test04/makefile b/Robust/src/Tests/OwnershipAnalysisTest/test04/makefile
new file mode 100644 (file)
index 0000000..348eb36
--- /dev/null
@@ -0,0 +1,28 @@
+PROGRAM=test03
+
+SOURCE_FILES=$(PROGRAM).java
+
+BUILDSCRIPT=~/research/Robust/src/buildscript
+BSFLAGS= -recover -ownership -ownaliasfile aliases.txt -enable-assertions
+OUTFLAGS= -ownwritedots final #-flatirusermethods
+
+all: $(PROGRAM).bin
+
+view: PNGs
+       eog *.png &
+
+PNGs: DOTs
+       d2p *COMPLETE*.dot
+
+DOTs: $(PROGRAM).bin
+
+$(PROGRAM).bin: $(SOURCE_FILES)
+       $(BUILDSCRIPT) $(BSFLAGS) $(OUTFLAGS) -o $(PROGRAM) $(SOURCE_FILES)
+
+clean:
+       rm -f  $(PROGRAM).bin
+       rm -fr tmpbuilddirectory
+       rm -f  *~
+       rm -f  *.dot
+       rm -f  *.png
+       rm -f  aliases.txt
diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test04/test04.java b/Robust/src/Tests/OwnershipAnalysisTest/test04/test04.java
new file mode 100644 (file)
index 0000000..8dbee93
--- /dev/null
@@ -0,0 +1,58 @@
+
+public class Parameter {
+  flag w;
+  Node root;
+  public Parameter() {}
+}
+
+public class Node {
+  HashSet neighbors;
+  
+  public Node() {
+    neighbors = new HashSet();
+  }
+  
+  public static Node makeNode() {
+    return new Node();
+  }
+  
+  public addNeighbor( Node n ) {
+    neighbors.add( n );
+  }
+}
+
+task Startup( StartupObject s{ initialstate } ) {
+  
+  Parameter p1 = new Parameter();
+  
+  taskexit( s{ !initialstate } );
+}
+
+
+task MakeGraph( Parameter p1{ !w } ) {
+
+  Parameter pKeep0;
+  Parameter pKeep1;
+  Parameter pKeep2;
+  Parameter p2;
+
+  while( false ) {  
+    pKeep2 = pKeep1;
+    pKeep1 = pKeep0;
+    pKeep0 = p2;
+
+    p2 = new Parameter();    
+
+    Node n1 = Node.makeNode();
+    Node n2 = Node.makeNode();
+    Node n3 = Node.makeNode();
+    
+    n1.addNeighbor( n2 );
+    n2.addNeighbor( n3 );
+    n3.addNeighbor( n1 );
+    
+    p2.root = n1;
+  }
+
+  taskexit( p1{ w } );
+}