Bug fix: when rewriting a token set every permutation with possible replacement token...
authorjjenista <jjenista>
Thu, 11 Sep 2008 22:32:53 +0000 (22:32 +0000)
committerjjenista <jjenista>
Thu, 11 Sep 2008 22:32:53 +0000 (22:32 +0000)
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java

index dbec6e31839bde5c2e4f2b6b57ef835ed7b9691e..9647234d763dec2b5ddc398c00ba28635de9100a 100644 (file)
@@ -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;
       }
index 1d3c2333c1e65fa2efde6051d18bedd98bba9e96..6323975a5849b169b248a850852abfee3678cc6f 100644 (file)
@@ -1616,8 +1616,8 @@ public class OwnershipGraph {
     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(),
@@ -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<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);
+       }
       }
     }
 
index 7efe6931acb99e5de77e81ccc8f151c935d39605..bea87c43ca549662e3aadabbfba3041765e34b55 100644 (file)
@@ -312,7 +312,7 @@ public class TokenTupleSet extends Canonical {
   public ReachabilitySet rewriteToken(TokenTuple tokenToRewrite,
                                       ReachabilitySet replacements,
                                       boolean makeChangeSet,
-                                      Hashtable<TokenTupleSet, TokenTupleSet> forChangeSet) {
+                                      Hashtable<TokenTupleSet, HashSet<TokenTupleSet> > 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<TokenTupleSet>() );
+         }
+         
+         forChangeSet.get(this).add(replaced);
        }
       }
     }