From 2779bd809b47ff2957f85081b158ecea032fe0fb Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 11 Sep 2008 22:32:53 +0000 Subject: [PATCH] Bug fix: when rewriting a token set every permutation with possible replacement tokens was overwriting, changed to keep all results in a set --- .../OwnershipAnalysis/OwnershipAnalysis.java | 6 +++--- .../OwnershipAnalysis/OwnershipGraph.java | 18 +++++++++++------- .../OwnershipAnalysis/TokenTupleSet.java | 9 +++++++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java index dbec6e31..9647234d 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java @@ -604,13 +604,13 @@ public class OwnershipAnalysis { // 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; } diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 1d3c2333..6323975a 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -1616,8 +1616,8 @@ public class OwnershipGraph { while( ttsItr.hasNext() ) { TokenTupleSet tts = ttsItr.next(); - Hashtable forChangeSet = - new Hashtable(); + Hashtable > forChangeSet = + new Hashtable >(); ReachabilitySet rTemp = tts.rewriteToken(tokenToRewrite, edge.getBeta(), @@ -1628,13 +1628,17 @@ public class OwnershipGraph { while( fcsItr.hasNext() ) { Map.Entry me = (Map.Entry)fcsItr.next(); TokenTupleSet ttsMatch = (TokenTupleSet) me.getKey(); - TokenTupleSet ttsAdd = (TokenTupleSet) me.getValue(); + HashSet ttsAddSet = (HashSet) me.getValue(); + Iterator 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); + } } } diff --git a/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java b/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java index 7efe6931..bea87c43 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java +++ b/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java @@ -312,7 +312,7 @@ public class TokenTupleSet extends Canonical { public ReachabilitySet rewriteToken(TokenTuple tokenToRewrite, ReachabilitySet replacements, boolean makeChangeSet, - Hashtable forChangeSet) { + Hashtable > forChangeSet) { ReachabilitySet rsOut = new ReachabilitySet().makeCanonical(); @@ -332,7 +332,12 @@ public class TokenTupleSet extends Canonical { if( makeChangeSet ) { assert forChangeSet != null; - forChangeSet.put(this, replaced); + + if( forChangeSet.get(this) == null ) { + forChangeSet.put(this, new HashSet() ); + } + + forChangeSet.get(this).add(replaced); } } } -- 2.34.1