// run in faster mode, only when bugs wrung out!
public static boolean releaseMode;
+ // use command line option to set this, analysis
+ // should attempt to be deterministic
+ public static boolean determinismDesired;
+
// data from the compiler
public State state;
public CallGraph callGraph;
this.arrayReferencees = arrayReferencees;
this.allocationDepth = state.DISJOINTALLOCDEPTH;
this.releaseMode = state.DISJOINTRELEASEMODE;
+ this.determinismDesired = state.DISJOINTDETERMINISM;
this.writeFinalDOTs = state.DISJOINTWRITEDOTS && !state.DISJOINTWRITEALL;
this.writeAllIncrementalDOTs = state.DISJOINTWRITEDOTS && state.DISJOINTWRITEALL;
Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
flatNodesToVisit.add( fm );
- Set<FlatNode> debugVisited = new HashSet<FlatNode>();
+ // if determinism is desired by client, shadow the
+ // set with a queue to make visit order deterministic
+ Queue<FlatNode> flatNodesToVisitQ = null;
+ if( determinismDesired ) {
+ flatNodesToVisitQ = new LinkedList<FlatNode>();
+ flatNodesToVisitQ.add( fm );
+ }
// mapping of current partial results
Hashtable<FlatNode, ReachGraph> mapFlatNodeToReachGraph =
HashSet<FlatReturnNode> setReturns = new HashSet<FlatReturnNode>();
while( !flatNodesToVisit.isEmpty() ) {
- FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next();
- flatNodesToVisit.remove( fn );
- debugVisited.add( fn );
+ FlatNode fn;
+ if( determinismDesired ) {
+ assert !flatNodesToVisitQ.isEmpty();
+ fn = flatNodesToVisitQ.remove();
+ } else {
+ fn = flatNodesToVisit.iterator().next();
+ }
+ flatNodesToVisit.remove( fn );
// effect transfer function defined by this node,
// then compare it to the old graph at this node
if( !rg.equals( rgPrev ) ) {
mapFlatNodeToReachGraph.put( fn, rg );
- for( int i = 0; i < pm.numNext(fn); i++ ) {
- FlatNode nn = pm.getNext(fn, i);
+ for( int i = 0; i < pm.numNext( fn ); i++ ) {
+ FlatNode nn = pm.getNext( fn, i );
+
flatNodesToVisit.add( nn );
+ if( determinismDesired ) {
+ flatNodesToVisitQ.add( nn );
+ }
}
}
}
- // assert that the fixed-point results for each
- // node in the method is no smaller than the last
- // time this method was analyzed (monotonicity)
- /*
- Iterator<FlatNode> nItr = fm.getNodeSet().iterator();
- while( nItr.hasNext() ) {
- FlatNode fn = nItr.next();
- ReachGraph last = fn2rg.get( fn );
- ReachGraph newest = mapFlatNodeToReachGraph.get( fn );
-
- if( newest == null ) {
- System.out.println( "**********\nfn null result: "+fn+
- "\nnum visited="+debugVisited.size()+", num in set="+fm.getNodeSet().size()+
- "\nvisited:"+debugVisited );
- }
-
- assert newest != null;
- if( last != null ) {
- if( !ReachGraph.isNoSmallerThan( last, newest ) ) {
- last.writeGraph( "last", true, false, false, true, true );
- newest.writeGraph( "newest", true, false, false, true, true );
- throw new Error( "transfer func for "+fn+" was not monotic" );
- }
- }
- fn2rg.put( fn, newest );
- }
- */
-
// end by merging all return nodes into a complete
// reach graph that represents all possible heap
// states after the flat method returns
#################################################
#DEBUGFLAGS= -disjoint-debug-callsite setClusters innerKMeansSetting 20
#DEBUGFLAGS= -disjoint-debug-callsite ensureCapacity addElement 100
-#DEBUGFLAGS= -disjoint-debug-callsite setReduceFinish reduceOutput 100
+#DEBUGFLAGS= -disjoint-debug-callsite setPartial reduceOutput 100
#################################################
##
#################################################
#SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeatureTask 5 10 true
#SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeature 5 1 true
-#SNAPFLAGS= -disjoint-debug-snap-method t3 1 1 true
+SNAPFLAGS= -disjoint-debug-snap-method t6 20 5 true
#SNAPFLAGS= -disjoint-debug-snap-method reduceOutput 5 50 true
#SNAPFLAGS= -disjoint-debug-snap-method setReduceFinish 5 50 true
-
+#SNAPFLAGS= -disjoint-debug-snap-method setPartial 1 50 true
BAMBOOFLAGS= -recover
JAVAFLAGS= -mainclass test
#VISITMODE= -disjoint-dvisit-stack
-#VISITMODE= -disjoint-dvisit-pqueue
-VISITMODE= -disjoint-dvisit-stack-callees-on-top
+VISITMODE= -disjoint-dvisit-pqueue
+#VISITMODE= -disjoint-dvisit-stack-callees-on-top
-DEBUGMODE= -enable-assertions -disjoint-write-dots final -disjoint-alias-file aliases.txt normal
+DEBUGMODE= -enable-assertions -disjoint-write-dots final -disjoint-alias-file aliases.txt normal -disjoint-desire-determinism
RELEASEMODE= -disjoint-release-mode -disjoint-alias-file aliases.txt tabbed
BSFLAGS= -justanalyze -disjoint -disjoint-k 1 -flatirusermethods