// should attempt to be deterministic
public static boolean determinismDesired;
+ // when we want to enforce determinism in the
+ // analysis we need to sort descriptors rather
+ // than toss them in efficient sets, use this
+ public static DescriptorComparator dComp =
+ new DescriptorComparator();
+
+
// data from the compiler
public State state;
public CallGraph callGraph;
public int allocationDepth;
// data structure for public interface
- private Hashtable<Descriptor, HashSet<AllocSite> > mapDescriptorToAllocSiteSet;
+ private Hashtable< Descriptor, HashSet<AllocSite> >
+ mapDescriptorToAllocSiteSet;
// for public interface methods to warn that they
if( determinismDesired ) {
// use an ordered set
- descriptorsToAnalyze
- = new TreeSet<Descriptor>( new DescriptorComparator() );
-
+ descriptorsToAnalyze = new TreeSet<Descriptor>( dComp );
} else {
// otherwise use a speedy hashset
descriptorsToAnalyze = new HashSet<Descriptor>();
writeFinalIHMs();
}
+ if( state.DISJOINTWRITEINITCONTEXTS ) {
+ writeInitialContexts();
+ }
+
if( state.DISJOINTALIASFILE != null ) {
if( state.TASK ) {
writeAllSharing(state.DISJOINTALIASFILE, treport, justtime, state.DISJOINTALIASTAB, state.lines);
if( state.DISJOINTDVISITSTACKEESONTOP ) {
- if( state.DISJOINTDEBUGSCHEDULING ) {
- System.out.println( " contexts changed, scheduling callees for analysis:" );
- }
-
depsItr = calleesToEnqueue.iterator();
while( depsItr.hasNext() ) {
Descriptor dNext = depsItr.next();
enqueue( dNext );
-
- if( state.DISJOINTDEBUGSCHEDULING ) {
- System.out.println( " "+dNext );
- }
}
calleesToEnqueue.clear();
}
rg.merge( rgContrib );
}
+
// additionally, we are enforcing STRICT MONOTONICITY for the
// method's initial context, so grow the context by whatever
// the previously computed context was, and put the most
// and reschedule the callee for analysis
addIHMcontribution( mdCallee, fc, heapForThisCall_cur );
+ if( state.DISJOINTDEBUGSCHEDULING ) {
+ System.out.println( " context changed, scheduling callee: "+mdCallee );
+ }
+
if( state.DISJOINTDVISITSTACKEESONTOP ) {
calleesToEnqueue.add( mdCallee );
} else {
enqueue( mdCallee );
-
- if( state.DISJOINTDEBUGSCHEDULING ) {
- System.out.println( " context changed, scheduling callee: "+mdCallee );
- }
-
}
}
// current heap abstraction with any effects from the callee,
// or if the method is virtual, the effects from any possible
// callees, so find the set of callees...
- Set<MethodDescriptor> setPossibleCallees =
- new HashSet<MethodDescriptor>();
+ Set<MethodDescriptor> setPossibleCallees;
+ if( determinismDesired ) {
+ // use an ordered set
+ setPossibleCallees = new TreeSet<MethodDescriptor>( dComp );
+ } else {
+ // otherwise use a speedy hashset
+ setPossibleCallees = new HashSet<MethodDescriptor>();
+ }
if( mdCallee.isStatic() ) {
setPossibleCallees.add( mdCallee );
calleesToEnqueue.add( mdPossible );
} else {
enqueue( mdPossible );
-
- if( state.DISJOINTDEBUGSCHEDULING ) {
- System.out.println( " callee hasn't been analyzed, scheduling: "+mdPossible );
- }
}
+
+ if( state.DISJOINTDEBUGSCHEDULING ) {
+ System.out.println( " callee hasn't been analyzed, scheduling: "+mdPossible );
+ }
+
} else {
rgCopy.resolveMethodCall( fc,
}
}
}
+
+ private void writeInitialContexts() {
+ Set entrySet = mapDescriptorToInitialContext.entrySet();
+ Iterator itr = entrySet.iterator();
+ while( itr.hasNext() ) {
+ Map.Entry me = (Map.Entry) itr.next();
+ Descriptor d = (Descriptor) me.getKey();
+ ReachGraph rg = (ReachGraph) me.getValue();
+
+ rg.writeGraph( "INITIAL"+d,
+ true, // write labels (variables)
+ true, // selectively hide intermediate temp vars
+ true, // prune unreachable heap regions
+ false, // hide subset reachability states
+ true ); // hide edge taints
+ }
+ }
protected ReachGraph getPartial( Descriptor d ) {
if( determinismDesired ) {
// use an ordered set
- discovered
- = new TreeSet<Descriptor>( new DescriptorComparator() );
-
+ discovered = new TreeSet<Descriptor>( dComp );
} else {
// otherwise use a speedy hashset
discovered = new HashSet<Descriptor>();
getIHMcontributions( d );
if( !heapsFromCallers.containsKey( fc ) ) {
- heapsFromCallers.put( fc, new ReachGraph() );
+ return null;
}
return heapsFromCallers.get( fc );
public int OWNERSHIPDEBUGCALLCOUNT=0;
public String OWNERSHIPDEBUGCALLEE=null;
public String OWNERSHIPDEBUGCALLER=null;
+
public boolean DISJOINT=false;
+
+ public int DISJOINTALLOCDEPTH=1;
public boolean DISJOINTRELEASEMODE=false;
public boolean DISJOINTDETERMINISM=false;
- public int DISJOINTALLOCDEPTH=3;
+
+ public boolean DISJOINTDVISITSTACK=true;
+ public boolean DISJOINTDVISITPQUE=false;
+ public boolean DISJOINTDVISITSTACKEESONTOP=false;
+
public boolean DISJOINTWRITEDOTS=false;
public boolean DISJOINTWRITEALL=false;
public boolean DISJOINTWRITEIHMS=false;
+ public boolean DISJOINTWRITEINITCONTEXTS=false;
+
public String DISJOINTALIASFILE=null;
public boolean DISJOINTALIASTAB=false;
public int DISJOINTSNAPNUMVISITS=0;
public boolean DISJOINTSNAPSTOPAFTER=false;
- public boolean DISJOINTDVISITSTACK=true;
- public boolean DISJOINTDVISITPQUE=false;
- public boolean DISJOINTDVISITSTACKEESONTOP=false;
-
public boolean DISJOINTDEBUGSCHEDULING=false;
+
public boolean OPTIONAL=false;
public boolean ARRAYPAD=false;
public boolean THREAD=false;