a common example to compare with shape analyis
authorjjenista <jjenista>
Tue, 22 Sep 2009 20:33:27 +0000 (20:33 +0000)
committerjjenista <jjenista>
Tue, 22 Sep 2009 20:33:27 +0000 (20:33 +0000)
Robust/src/Tests/OwnershipAnalysisTest/versusShape/makefile [new file with mode: 0644]
Robust/src/Tests/OwnershipAnalysisTest/versusShape/test.java [new file with mode: 0644]

diff --git a/Robust/src/Tests/OwnershipAnalysisTest/versusShape/makefile b/Robust/src/Tests/OwnershipAnalysisTest/versusShape/makefile
new file mode 100644 (file)
index 0000000..fdfcf35
--- /dev/null
@@ -0,0 +1,27 @@
+PROGRAM=test
+
+SOURCE_FILES=$(PROGRAM).java
+
+BUILDSCRIPT=~/research/Robust/src/buildscript
+BSFLAGS= -mainclass Test -justanalyze -ownership -ownallocdepth 1 -ownwritedots final -ownaliasfile aliases.txt -enable-assertions
+
+all: $(PROGRAM).bin
+
+view: PNGs
+       eog *.png &
+
+PNGs: DOTs
+       d2p *COMPLETE*.dot
+
+DOTs: $(PROGRAM).bin
+
+$(PROGRAM).bin: $(SOURCE_FILES)
+       $(BUILDSCRIPT) $(BSFLAGS) -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/versusShape/test.java b/Robust/src/Tests/OwnershipAnalysisTest/versusShape/test.java
new file mode 100644 (file)
index 0000000..b30fe51
--- /dev/null
@@ -0,0 +1,40 @@
+public class SparseGraph {
+  Node head;
+  public SparseGraph() {
+    head = null;
+  }
+}
+
+public class DenseGraph {
+  Node head;
+  public DenseGraph() {
+    head = null;
+  }
+}
+
+public class Node {
+  public int value;
+  public HashSet nodes;
+  public Node( int v ) {
+    value = v;
+    nodes = new HashSet();
+  }
+}
+
+
+public class Test {
+
+  static public void main( String[] args ) {
+    HashSet sSet = new HashSet();
+    HashSet dSet = new HashSet();
+    for( int i = 0; i < 100; ++i ) {
+      SparseGraph sNew = disjoint sparse new SparseGraph();
+      DenseGraph  dNew = disjoint dense  new DenseGraph();
+      sSet.add( sNew );
+      dSet.add( dNew );
+      SparseGraph s = (SparseGraph) sSet.iterator().next();
+      DenseGraph  d = (DenseGraph)  dSet.iterator().next();
+      
+    }
+  }
+}