// insert a call to debugSnapshot() somewhere in the analysis to get
// successive captures of the analysis state
int debugCounter = 0;
- int numIterationsIn = 30;
- int numIterationsToCapture = 20;
+ int numIterationsIn = 80000;
+ int numIterationsToCapture = 53;
void debugSnapshot( OwnershipGraph og, FlatNode fn ) {
++debugCounter;
if( debugCounter > numIterationsIn ) {
System.out.println( " @@@ capturing debug "+(debugCounter-numIterationsIn)+" @@@" );
- String graphName = String.format("test%04d",debugCounter-numIterationsIn);
+ String graphName = String.format("snap%04d",debugCounter-numIterationsIn);
if( fn != null ) {
graphName = graphName+fn;
}
while( ttsItr.hasNext() ) {
TokenTupleSet tts = ttsItr.next();
- Hashtable<TokenTupleSet, TokenTupleSet> forChangeSet =
- new Hashtable<TokenTupleSet, TokenTupleSet>();
+ Hashtable<TokenTupleSet, HashSet<TokenTupleSet> > forChangeSet =
+ new Hashtable<TokenTupleSet, HashSet<TokenTupleSet> >();
ReachabilitySet rTemp = tts.rewriteToken(tokenToRewrite,
edge.getBeta(),
while( fcsItr.hasNext() ) {
Map.Entry me = (Map.Entry)fcsItr.next();
TokenTupleSet ttsMatch = (TokenTupleSet) me.getKey();
- TokenTupleSet ttsAdd = (TokenTupleSet) me.getValue();
+ HashSet<TokenTupleSet> ttsAddSet = (HashSet<TokenTupleSet>) me.getValue();
+ Iterator<TokenTupleSet> ttsAddItr = ttsAddSet.iterator();
+ while( ttsAddItr.hasNext() ) {
+ TokenTupleSet ttsAdd = ttsAddItr.next();
- ChangeTuple ct = new ChangeTuple(ttsMatch,
- ttsAdd
- ).makeCanonical();
+ ChangeTuple ct = new ChangeTuple(ttsMatch,
+ ttsAdd
+ ).makeCanonical();
- cts0 = cts0.union(ct);
+ cts0 = cts0.union(ct);
+ }
}
}
public ReachabilitySet rewriteToken(TokenTuple tokenToRewrite,
ReachabilitySet replacements,
boolean makeChangeSet,
- Hashtable<TokenTupleSet, TokenTupleSet> forChangeSet) {
+ Hashtable<TokenTupleSet, HashSet<TokenTupleSet> > forChangeSet) {
ReachabilitySet rsOut = new ReachabilitySet().makeCanonical();
if( makeChangeSet ) {
assert forChangeSet != null;
- forChangeSet.put(this, replaced);
+
+ if( forChangeSet.get(this) == null ) {
+ forChangeSet.put(this, new HashSet<TokenTupleSet>() );
+ }
+
+ forChangeSet.get(this).add(replaced);
}
}
}