--- /dev/null
+//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() );
+ }
+}
--- /dev/null
+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
--- /dev/null
+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";
+ }
+ */
+}
--- /dev/null
+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
--- /dev/null
+time ./OoOJavaExamplep.bin large
--- /dev/null
+time ./OoOJavaExampler.bin large
--- /dev/null
+time ./OoOJavaExamples.bin large
--- /dev/null
+//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() );
+ }
+}
--- /dev/null
+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";
+ }
+ */
+}
--- /dev/null
+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
--- /dev/null
+time ./OoOJavaExamplep.bin large
--- /dev/null
+time ./OoOJavaExampler.bin large
--- /dev/null
+time ./OoOJavaExamples.bin large