add profile codes for multicore version
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / ReachabilitySet.java
index caedeadedb1bd21d4c4b4e24415bbc2eb05eaeb7..391e2758b6443cab1133db36e346997317398806 100644 (file)
@@ -46,7 +46,7 @@ public class ReachabilitySet extends Canonical {
     return possibleReachabilities.iterator();
   }
 
-  
+
   public int size() {
     return possibleReachabilities.size();
   }
@@ -135,32 +135,32 @@ public class ReachabilitySet extends Canonical {
       while( itrR.hasNext() ) {
        TokenTupleSet r = (TokenTupleSet) itrR.next();
 
-       TokenTupleSet theUnion = new TokenTupleSet();
+       TokenTupleSet theUnion = new TokenTupleSet().makeCanonical();
 
        Iterator itrRelement = r.iterator();
        while( itrRelement.hasNext() ) {
          TokenTuple ttR = (TokenTuple) itrRelement.next();
-         TokenTuple ttO = o.containsToken( ttR.getToken() );
+         TokenTuple ttO = o.containsToken(ttR.getToken() );
 
          if( ttO != null ) {
-           theUnion = theUnion.union( new TokenTupleSet( ttR.unionArity(ttO) ) ).makeCanonical();
+           theUnion = theUnion.union(new TokenTupleSet(ttR.unionArity(ttO) ) ).makeCanonical();
          } else {
-           theUnion = theUnion.union( new TokenTupleSet( ttR                 ) ).makeCanonical();
+           theUnion = theUnion.union(new TokenTupleSet(ttR) ).makeCanonical();
          }
        }
 
        Iterator itrOelement = o.iterator();
        while( itrOelement.hasNext() ) {
          TokenTuple ttO = (TokenTuple) itrOelement.next();
-         TokenTuple ttR = theUnion.containsToken( ttO.getToken() );
+         TokenTuple ttR = theUnion.containsToken(ttO.getToken() );
 
          if( ttR == null ) {
-           theUnion = theUnion.union( new TokenTupleSet(ttO) ).makeCanonical();
+           theUnion = theUnion.union(new TokenTupleSet(ttO) ).makeCanonical();
          }
        }
-       
+
        if( !theUnion.isEmpty() ) {
-         ctsOut = ctsOut.union( new ChangeTupleSet( new ChangeTuple(o, theUnion) ) );
+         ctsOut = ctsOut.union(new ChangeTupleSet(new ChangeTuple(o, theUnion) ) );
        }
       }
     }
@@ -248,7 +248,7 @@ public class ReachabilitySet extends Canonical {
 
     int numDimensions = this.possibleReachabilities.size();
 
-    if( numDimensions > 6 ) {
+    if( numDimensions > 1 ) {
       // for problems that are too big, punt and use less
       // precise arity for reachability information
       TokenTupleSet ttsImprecise = new TokenTupleSet().makeCanonical();
@@ -256,14 +256,14 @@ public class ReachabilitySet extends Canonical {
       Iterator<TokenTupleSet> itrThis = this.iterator();
       while( itrThis.hasNext() ) {
        TokenTupleSet ttsUnit = itrThis.next();
-       ttsImprecise = ttsImprecise.unionUpArity( ttsUnit.makeArityZeroOrMore() );
+       ttsImprecise = ttsImprecise.unionUpArity(ttsUnit.makeArityZeroOrMore() );
       }
 
-      rsOut = rsOut.union( ttsImprecise );
+      //rsOut = this.union( ttsImprecise );
+      rsOut = rsOut.union(ttsImprecise);
       return rsOut;
     }
 
-
     // add an extra digit to detect termination
     int[] digits = new int[numDimensions+1];
 
@@ -322,8 +322,24 @@ public class ReachabilitySet extends Canonical {
     return possibleReachabilities.equals(rs.possibleReachabilities);
   }
 
+
+  private boolean oldHashSet = false;
+  private int oldHash    = 0;
   public int hashCode() {
-    return possibleReachabilities.hashCode();
+    int currentHash = possibleReachabilities.hashCode();
+
+    if( oldHashSet == false ) {
+      oldHash = currentHash;
+      oldHashSet = true;
+    } else {
+      if( oldHash != currentHash ) {
+       System.out.println("IF YOU SEE THIS A CANONICAL ReachabilitySet CHANGED");
+       Integer x = null;
+       x.toString();
+      }
+    }
+
+    return currentHash;
   }