keep a copy of my current dissertation example to investiaget further and another...
authorjjenista <jjenista>
Thu, 31 May 2012 02:09:01 +0000 (02:09 +0000)
committerjjenista <jjenista>
Thu, 31 May 2012 02:09:01 +0000 (02:09 +0000)
13 files changed:
Robust/src/Benchmarks/oooJava/dissertation-example-investigate/OoOJavaExample.java [new file with mode: 0644]
Robust/src/Benchmarks/oooJava/dissertation-example-investigate/README [new file with mode: 0644]
Robust/src/Benchmarks/oooJava/dissertation-example-investigate/TreeNode.java [new file with mode: 0644]
Robust/src/Benchmarks/oooJava/dissertation-example-investigate/makefile [new file with mode: 0644]
Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runp [new file with mode: 0755]
Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runr [new file with mode: 0755]
Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runs [new file with mode: 0755]
Robust/src/Benchmarks/oooJava/dissertation-example/OoOJavaExample.java [new file with mode: 0644]
Robust/src/Benchmarks/oooJava/dissertation-example/TreeNode.java [new file with mode: 0644]
Robust/src/Benchmarks/oooJava/dissertation-example/makefile [new file with mode: 0644]
Robust/src/Benchmarks/oooJava/dissertation-example/runp [new file with mode: 0755]
Robust/src/Benchmarks/oooJava/dissertation-example/runr [new file with mode: 0755]
Robust/src/Benchmarks/oooJava/dissertation-example/runs [new file with mode: 0755]

diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/OoOJavaExample.java b/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/OoOJavaExample.java
new file mode 100644 (file)
index 0000000..96ed5ab
--- /dev/null
@@ -0,0 +1,83 @@
+//import java.io.*;
+//import java.util.*;
+
+public class OoOJavaExample {
+  
+  public static void main( String[] args ) {
+    OoOJavaExample ex = new OoOJavaExample( 1234, 100, 0.05f, 15 );
+    ex.runExample();
+  }
+
+  private HashSet roots;
+  //private HashMap bin2set;
+
+  public OoOJavaExample( int seed, int numTrees, float probNull, int maxTreeDepth ) {
+    Random random = new Random( seed );
+
+    roots = new HashSet();
+    for( int i = 0; i < numTrees; ++i ) {
+      roots.add( makeNewTree( random, probNull, maxTreeDepth ) );
+    }
+
+    //bin2set = new HashMap();
+  }
+
+  private TreeNode makeNewTree( Random random, float probNull, int maxTreeDepth ) {
+
+    TreeNode root = new TreeNode( random.nextFloat() );
+
+    TreeNode left = buildSubTree( random, probNull, maxTreeDepth, 0 ); 
+    root.left = left;
+    
+    TreeNode right = buildSubTree( random, probNull, maxTreeDepth, 0 ); 
+    root.right = right;
+    
+    return root;
+  }
+
+
+  private TreeNode buildSubTree( Random random, float probNull, int maxTreeDepth, int depth ) {
+
+    TreeNode node = new TreeNode( random.nextFloat() );
+    if( depth > maxTreeDepth || random.nextFloat() < probNull ) {
+      genreach retearly;
+      return node;
+    }
+
+    TreeNode left = buildSubTree( random, probNull, maxTreeDepth, depth + 1 );
+    node.left = left;
+    
+    TreeNode right = buildSubTree( random, probNull, maxTreeDepth, depth + 1 );
+    node.right = right;
+
+    genreach retlate;
+    return node;
+  }
+
+  public void runExample() {
+    Iterator itr = roots.iterator();
+
+    int zzz = 0;
+      
+    while( itr.hasNext() ) {
+      TreeNode root = (TreeNode) itr.next();
+  
+      sese par {
+        int weightBin = (int) root.computeTreeWeight();
+      }
+      sese seq {
+        zzz += weightBin;
+        /*
+        HashSet set = (HashSet)bin2set.get( weightBin );
+        if( set == null ) {
+          set = new HashSet();
+          bin2set.put( weightBin, set );
+        }
+        set.add( root );
+        */
+      }
+    }
+
+    System.out.println( "Num weight bins: "+zzz ); //bin2set.size() );
+  }
+}
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/README b/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/README
new file mode 100644 (file)
index 0000000..f82c0b0
--- /dev/null
@@ -0,0 +1,16 @@
+Why doesn't the example work written like this?
+
+In makeNewTree when 
+TreeNode left = buildSubTree( ...
+
+The variable edge from left has reachability states
+saying it can get to an object reachable from previous
+root objects, which seems obviously over conservative, then
+
+root.left = left;
+
+seals the deal and updates the graph by introducing states that admit
+reachability from both the newest root and a previous root.
+
+
+Why did that happen?
\ No newline at end of file
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/TreeNode.java b/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/TreeNode.java
new file mode 100644 (file)
index 0000000..79769a6
--- /dev/null
@@ -0,0 +1,72 @@
+public class TreeNode {
+  TreeNode left;
+  TreeNode right;
+  double nodeWeight;
+  boolean treeWeightComputed;
+  double treeWeight;
+  
+  /*
+  public TreeNode( TreeNode left, TreeNode right, double nodeWeight ) {
+    this.left = left;
+    this.right = right;
+    this.nodeWeight = nodeWeight;
+    treeWeightComputed = false;
+  }
+  */
+
+  public TreeNode( double nodeWeight ) {
+    //this( null, null, nodeWeight );
+    this.nodeWeight = nodeWeight;
+    treeWeightComputed = false;
+  }
+
+  /*
+  public void setLeft( TreeNode left ) {
+    this.left = left;
+  }
+
+  public void setRight( TreeNode right ) {
+    this.right = right;
+  }
+  */
+
+  public double computeTreeWeight() {
+    if( treeWeightComputed ) {
+      return treeWeight;
+    }
+    treeWeight = nodeWeight;
+    if( left != null ) {
+      treeWeight += left.computeTreeWeight();
+    }
+    if( right != null ) {
+      treeWeight += right.computeTreeWeight();
+    }
+    treeWeightComputed = true;
+    return treeWeight;
+  }
+
+  /*
+  public String toString() {
+    String s = toString( "", "" );
+    if( treeWeightComputed ) {
+      s += "tree weight: "+treeWeight;
+    }
+    return s;
+  }
+
+  private String toString( String tab, String prefix ) {
+    String s = tab+nodeWeight+" {\n";
+    if( left != null ) {
+      s += left.toString( tab+"  ", s );
+    } else {
+      s += tab+"  null\n";
+    }
+    if( right != null ) {
+      s += right.toString( tab+"  ", s );
+    } else {
+      s += tab+"  null\n";
+    }
+    return s+tab+"}\n";
+  }
+  */
+}
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/makefile b/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/makefile
new file mode 100644 (file)
index 0000000..2ec9880
--- /dev/null
@@ -0,0 +1,15 @@
+PROGRAM=OoOJavaExample
+
+SOURCE_FILES=OoOJavaExample.java
+
+NUM_OOO_WORKERS=24
+NUM_RCR_WORKERS=23
+
+BMFLAGS= -heapsize-mb 5000
+
+DISJOINTDEBUGEXTRAS= -disjoint-write-dots final
+#-disjoint-debug-snap-method OoOJavaExample.OoOJavaExample 0 100 true
+#
+#-do-definite-reach-analysis
+
+include ../master-makefile
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runp b/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runp
new file mode 100755 (executable)
index 0000000..1630395
--- /dev/null
@@ -0,0 +1 @@
+time ./OoOJavaExamplep.bin large
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runr b/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runr
new file mode 100755 (executable)
index 0000000..85d2bd9
--- /dev/null
@@ -0,0 +1 @@
+time ./OoOJavaExampler.bin large
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runs b/Robust/src/Benchmarks/oooJava/dissertation-example-investigate/runs
new file mode 100755 (executable)
index 0000000..f7af281
--- /dev/null
@@ -0,0 +1 @@
+time ./OoOJavaExamples.bin large
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example/OoOJavaExample.java b/Robust/src/Benchmarks/oooJava/dissertation-example/OoOJavaExample.java
new file mode 100644 (file)
index 0000000..96ed5ab
--- /dev/null
@@ -0,0 +1,83 @@
+//import java.io.*;
+//import java.util.*;
+
+public class OoOJavaExample {
+  
+  public static void main( String[] args ) {
+    OoOJavaExample ex = new OoOJavaExample( 1234, 100, 0.05f, 15 );
+    ex.runExample();
+  }
+
+  private HashSet roots;
+  //private HashMap bin2set;
+
+  public OoOJavaExample( int seed, int numTrees, float probNull, int maxTreeDepth ) {
+    Random random = new Random( seed );
+
+    roots = new HashSet();
+    for( int i = 0; i < numTrees; ++i ) {
+      roots.add( makeNewTree( random, probNull, maxTreeDepth ) );
+    }
+
+    //bin2set = new HashMap();
+  }
+
+  private TreeNode makeNewTree( Random random, float probNull, int maxTreeDepth ) {
+
+    TreeNode root = new TreeNode( random.nextFloat() );
+
+    TreeNode left = buildSubTree( random, probNull, maxTreeDepth, 0 ); 
+    root.left = left;
+    
+    TreeNode right = buildSubTree( random, probNull, maxTreeDepth, 0 ); 
+    root.right = right;
+    
+    return root;
+  }
+
+
+  private TreeNode buildSubTree( Random random, float probNull, int maxTreeDepth, int depth ) {
+
+    TreeNode node = new TreeNode( random.nextFloat() );
+    if( depth > maxTreeDepth || random.nextFloat() < probNull ) {
+      genreach retearly;
+      return node;
+    }
+
+    TreeNode left = buildSubTree( random, probNull, maxTreeDepth, depth + 1 );
+    node.left = left;
+    
+    TreeNode right = buildSubTree( random, probNull, maxTreeDepth, depth + 1 );
+    node.right = right;
+
+    genreach retlate;
+    return node;
+  }
+
+  public void runExample() {
+    Iterator itr = roots.iterator();
+
+    int zzz = 0;
+      
+    while( itr.hasNext() ) {
+      TreeNode root = (TreeNode) itr.next();
+  
+      sese par {
+        int weightBin = (int) root.computeTreeWeight();
+      }
+      sese seq {
+        zzz += weightBin;
+        /*
+        HashSet set = (HashSet)bin2set.get( weightBin );
+        if( set == null ) {
+          set = new HashSet();
+          bin2set.put( weightBin, set );
+        }
+        set.add( root );
+        */
+      }
+    }
+
+    System.out.println( "Num weight bins: "+zzz ); //bin2set.size() );
+  }
+}
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example/TreeNode.java b/Robust/src/Benchmarks/oooJava/dissertation-example/TreeNode.java
new file mode 100644 (file)
index 0000000..79769a6
--- /dev/null
@@ -0,0 +1,72 @@
+public class TreeNode {
+  TreeNode left;
+  TreeNode right;
+  double nodeWeight;
+  boolean treeWeightComputed;
+  double treeWeight;
+  
+  /*
+  public TreeNode( TreeNode left, TreeNode right, double nodeWeight ) {
+    this.left = left;
+    this.right = right;
+    this.nodeWeight = nodeWeight;
+    treeWeightComputed = false;
+  }
+  */
+
+  public TreeNode( double nodeWeight ) {
+    //this( null, null, nodeWeight );
+    this.nodeWeight = nodeWeight;
+    treeWeightComputed = false;
+  }
+
+  /*
+  public void setLeft( TreeNode left ) {
+    this.left = left;
+  }
+
+  public void setRight( TreeNode right ) {
+    this.right = right;
+  }
+  */
+
+  public double computeTreeWeight() {
+    if( treeWeightComputed ) {
+      return treeWeight;
+    }
+    treeWeight = nodeWeight;
+    if( left != null ) {
+      treeWeight += left.computeTreeWeight();
+    }
+    if( right != null ) {
+      treeWeight += right.computeTreeWeight();
+    }
+    treeWeightComputed = true;
+    return treeWeight;
+  }
+
+  /*
+  public String toString() {
+    String s = toString( "", "" );
+    if( treeWeightComputed ) {
+      s += "tree weight: "+treeWeight;
+    }
+    return s;
+  }
+
+  private String toString( String tab, String prefix ) {
+    String s = tab+nodeWeight+" {\n";
+    if( left != null ) {
+      s += left.toString( tab+"  ", s );
+    } else {
+      s += tab+"  null\n";
+    }
+    if( right != null ) {
+      s += right.toString( tab+"  ", s );
+    } else {
+      s += tab+"  null\n";
+    }
+    return s+tab+"}\n";
+  }
+  */
+}
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example/makefile b/Robust/src/Benchmarks/oooJava/dissertation-example/makefile
new file mode 100644 (file)
index 0000000..2ec9880
--- /dev/null
@@ -0,0 +1,15 @@
+PROGRAM=OoOJavaExample
+
+SOURCE_FILES=OoOJavaExample.java
+
+NUM_OOO_WORKERS=24
+NUM_RCR_WORKERS=23
+
+BMFLAGS= -heapsize-mb 5000
+
+DISJOINTDEBUGEXTRAS= -disjoint-write-dots final
+#-disjoint-debug-snap-method OoOJavaExample.OoOJavaExample 0 100 true
+#
+#-do-definite-reach-analysis
+
+include ../master-makefile
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example/runp b/Robust/src/Benchmarks/oooJava/dissertation-example/runp
new file mode 100755 (executable)
index 0000000..1630395
--- /dev/null
@@ -0,0 +1 @@
+time ./OoOJavaExamplep.bin large
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example/runr b/Robust/src/Benchmarks/oooJava/dissertation-example/runr
new file mode 100755 (executable)
index 0000000..85d2bd9
--- /dev/null
@@ -0,0 +1 @@
+time ./OoOJavaExampler.bin large
diff --git a/Robust/src/Benchmarks/oooJava/dissertation-example/runs b/Robust/src/Benchmarks/oooJava/dissertation-example/runs
new file mode 100755 (executable)
index 0000000..f7af281
--- /dev/null
@@ -0,0 +1 @@
+time ./OoOJavaExamples.bin large