return toAdd;
}
+
public boolean equals(Object o) {
if( o == null ) {
return false;
toAdd.equals(ct.getSetToAdd() );
}
+ private boolean oldHashSet = false;
+ private int oldHash = 0;
public int hashCode() {
- return toMatch.hashCode() + toAdd.hashCode()*3;
+ int currentHash = toMatch.hashCode() + toAdd.hashCode()*3;
+
+ if( oldHashSet == false ) {
+ oldHash = currentHash;
+ oldHashSet = true;
+ } else {
+ if( oldHash != currentHash ) {
+ System.out.println( "IF YOU SEE THIS A CANONICAL ChangeTuple CHANGED" );
+ Integer x = null;
+ x.toString();
+ }
+ }
+
+ return currentHash;
}
+
public String toString() {
return new String("("+toMatch+" -> "+toAdd+")");
}
return ctsIn.changeTuples.containsAll(this.changeTuples);
}
+
public boolean equals(Object o) {
if( o == null ) {
return false;
return changeTuples.equals(cts.changeTuples);
}
+ private boolean oldHashSet = false;
+ private int oldHash = 0;
public int hashCode() {
- return changeTuples.hashCode();
+ int currentHash = changeTuples.hashCode();
+
+ if( oldHashSet == false ) {
+ oldHash = currentHash;
+ oldHashSet = true;
+ } else {
+ if( oldHash != currentHash ) {
+ System.out.println( "IF YOU SEE THIS A CANONICAL ChangeTupleSet CHANGED" );
+ Integer x = null;
+ x.toString();
+ }
+ }
+
+ return currentHash;
}
+
public String toString() {
String s = "[";
public void applyAlphaNew() {
assert alphaNew != null;
-
alpha = alphaNew;
-
- alphaNew = new ReachabilitySet();
- alphaNew = alphaNew.makeCanonical();
+ alphaNew = new ReachabilitySet().makeCanonical();
}
og);
-
//debugSnapshot(og,fn);
// insert a call to debugSnapshot() somewhere in the analysis to get
// successive captures of the analysis state
int debugCounter = 0;
- int numStartCountReport = 10000;
- int freqCountReport = 10;
- int iterStartCapture = 50;
- int numIterToCapture = 16;
+ int numStartCountReport = 0;
+ int freqCountReport = 1000;
+ int iterStartCapture = 20000;
+ int numIterToCapture = 400;
void debugSnapshot( OwnershipGraph og, FlatNode fn ) {
++debugCounter;
if( debugCounter > numStartCountReport &&
graphName = graphName+fn;
}
try {
- og.writeGraph( graphName, true, true, true, false, false );
+ og.writeGraph( graphName, true, true, false, false, false );
} catch( Exception e ) {
System.out.println( "Error writing debug capture." );
System.exit( 0 );
if( alpha == null ) {
if( isFlagged || isParameter ) {
- alpha = new ReachabilitySet(new TokenTuple(id,
+ alpha = new ReachabilitySet(
+ new TokenTuple(id,
!isSingleObject,
- TokenTuple.ARITY_ONE)
+ TokenTuple.ARITY_ONE
+ ).makeCanonical()
).makeCanonical();
} else {
- alpha = new ReachabilitySet(new TokenTupleSet()
+ alpha = new ReachabilitySet(
+ new TokenTupleSet().makeCanonical()
).makeCanonical();
}
}
edgesWithNewBeta);
- if( edgeY.getBetaNew().equals( new ReachabilitySet() ) ) {
+ // THIS IS A HACK--NEED TO CHANGE GENERATATION OF BETA-NEW SO THIS DOESN'T
+ // HAPPEN OTHERWISE PROPAGATION FAILS
+ if( edgeY.getBetaNew().equals( new ReachabilitySet().makeCanonical() ) ) {
edgeY.setBetaNew( new ReachabilitySet( new TokenTupleSet().makeCanonical() ).makeCanonical() );
}
+
+
/*
System.out.println( "---------------------------\n" +
ReachabilitySet beta = new ReachabilitySet(new TokenTuple(newID,
true,
- TokenTuple.ARITY_ONE) );
+ TokenTuple.ARITY_ONE).makeCanonical()
+ ).makeCanonical();
// heap regions for parameters are always multiple object (see above)
// and have a reference to themselves, because we can't know the
// after tokens have been aged, reset newest node's reachability
if( hrn0.isFlagged() ) {
- hrn0.setAlpha(new ReachabilitySet(new TokenTupleSet(
- new TokenTuple(hrn0)
- )
+ hrn0.setAlpha(new ReachabilitySet(
+ new TokenTupleSet(
+ new TokenTuple(hrn0).makeCanonical()
+ ).makeCanonical()
).makeCanonical()
);
} else {
- hrn0.setAlpha(new ReachabilitySet(new TokenTupleSet()
+ hrn0.setAlpha(new ReachabilitySet(
+ new TokenTupleSet().makeCanonical()
).makeCanonical()
);
}
// of new callee nodes and edges, doesn't belong to any parameter
Integer bogusID = new Integer(-1);
Integer bogusIndex = new Integer(-1);
- TokenTuple bogusToken = new TokenTuple(bogusID, true, TokenTuple.ARITY_ONE);
- TokenTuple bogusTokenPlus = new TokenTuple(bogusID, true, TokenTuple.ARITY_ONEORMORE);
+ TokenTuple bogusToken = new TokenTuple(bogusID, true, TokenTuple.ARITY_ONE).makeCanonical();
+ TokenTuple bogusTokenPlus = new TokenTuple(bogusID, true, TokenTuple.ARITY_ONEORMORE).makeCanonical();
ReachabilitySet rsIdentity =
- new ReachabilitySet(new TokenTupleSet(bogusToken).makeCanonical() ).makeCanonical();
+ new ReachabilitySet(
+ new TokenTupleSet(bogusToken).makeCanonical()
+ ).makeCanonical();
paramIndex2rewriteH.put(bogusIndex, rsIdentity);
paramIndex2rewriteJ.put(bogusIndex, rsIdentity);
null,
edgeCallee.getFieldDesc(),
false,
- toShadowTokens(ogCallee, edgeCallee.getBeta() )
+ toShadowTokens(ogCallee,
+ edgeCallee.getBeta() )
);
rewriteCallerReachability(bogusIndex,
null,
null,
edgeCallee.getFieldDesc(),
false,
- toShadowTokens(ogCallee, edgeCallee.getBeta() )
+ toShadowTokens(ogCallee,
+ edgeCallee.getBeta() )
);
rewriteCallerReachability(bogusIndex,
null,
private ReachabilitySet toShadowTokens(OwnershipGraph ogCallee,
ReachabilitySet rsIn) {
- ReachabilitySet rsOut = new ReachabilitySet(rsIn);
+ ReachabilitySet rsOut = new ReachabilitySet(rsIn).makeCanonical();
Iterator<AllocationSite> allocItr = ogCallee.allocationSites.iterator();
while( allocItr.hasNext() ) {
while( itrR.hasNext() ) {
TokenTupleSet r = (TokenTupleSet) itrR.next();
- TokenTupleSet theUnion = new TokenTupleSet();
+ TokenTupleSet theUnion = new TokenTupleSet().makeCanonical();
Iterator itrRelement = r.iterator();
while( itrRelement.hasNext() ) {
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();
ttsImprecise = ttsImprecise.unionUpArity( ttsUnit.makeArityZeroOrMore() );
}
+ //rsOut = this.union( ttsImprecise );
rsOut = rsOut.union( ttsImprecise );
return rsOut;
}
-
// add an extra digit to detect termination
int[] digits = new int[numDimensions+1];
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;
}
arity == tt.getArity();
}
+ private boolean oldHashSet = false;
+ private int oldHash = 0;
public int hashCode() {
- return token.intValue()*31 + arity;
+ int currentHash = token.intValue()*31 + arity;
+
+ if( oldHashSet == false ) {
+ oldHash = currentHash;
+ oldHashSet = true;
+ } else {
+ if( oldHash != currentHash ) {
+ System.out.println( "IF YOU SEE THIS A CANONICAL TokenTuple CHANGED" );
+ Integer x = null;
+ x.toString();
+ }
+ }
+
+ return currentHash;
}
}
+ public TokenTupleSet union(TokenTuple ttIn) {
+ assert ttIn != null;
+ TokenTupleSet ttsOut = new TokenTupleSet(this);
+ ttsOut.tokenTuples.add(ttIn);
+ return ttsOut.makeCanonical();
+ }
+
public TokenTupleSet union(TokenTupleSet ttsIn) {
assert ttsIn != null;
TokenTupleSet ttsOut = new TokenTupleSet(this);
return tokenTuples.equals(tts.tokenTuples);
}
+
+
+ private boolean oldHashSet = false;
+ private int oldHash = 0;
public int hashCode() {
- return tokenTuples.hashCode();
+ int currentHash = tokenTuples.hashCode();
+
+ if( oldHashSet == false ) {
+ oldHash = currentHash;
+ oldHashSet = true;
+ } else {
+ if( oldHash != currentHash ) {
+ System.out.println( "IF YOU SEE THIS A CANONICAL TokenTupleSet CHANGED" );
+ Integer x = null;
+ x.toString();
+ }
+ }
+
+ return currentHash;
}
// summary tokens and tokens not associated with
// the site should be left alone
if( age == AllocationSite.AGE_notInThisSite ) {
- ttsOut.tokenTuples.add(tt);
+ ttsOut = ttsOut.union(tt);
} else if( age == AllocationSite.AGE_summary ) {
- ttsOut.tokenTuples.add(tt.changeTokenTo(as.getSummaryShadow() ));
+ ttsOut = ttsOut.union(tt.changeTokenTo(as.getSummaryShadow() ));
} else if( age == AllocationSite.AGE_oldest ) {
- ttsOut.tokenTuples.add(tt.changeTokenTo(as.getOldestShadow() ));
+ ttsOut = ttsOut.union(tt.changeTokenTo(as.getOldestShadow() ));
} else {
assert age == AllocationSite.AGE_in_I;
Integer I = as.getAge(token);
assert I != null;
- ttsOut.tokenTuples.add(tt.changeTokenTo(as.getIthOldestShadow(I) ));
+ ttsOut = ttsOut.union(tt.changeTokenTo(as.getIthOldestShadow(I) ));
}
}
Iterator<TokenTupleSet> replaceItr = replacements.iterator();
while( replaceItr.hasNext() ) {
TokenTupleSet replacement = replaceItr.next();
- TokenTupleSet replaced = new TokenTupleSet(ttsMinusToken);
+ TokenTupleSet replaced = new TokenTupleSet(ttsMinusToken).makeCanonical();
replaced = replaced.unionUpArity(replacement);
rsOut = rsOut.add(replaced);
return ttsOut.makeCanonical();
}
-
-
+
public String toString() {
return tokenTuples.toString();
}
flag w;
int a;
int b;
- //Parameter f;
- //Parameter g;
- //Penguin p;
- //Foo h;
+ Parameter f;
+ Parameter g;
+ Penguin p;
+ Foo h;
- public Parameter() {} // a = 0; b = 0; f = null; g = null; }
+ public Parameter() {}
- //public void bar() { foo(); }
- //public void foo() { bar(); }
+ public void bar() { foo(); }
+ public void foo() { bar(); }
static public void proof( Fooz p0, Fooz p1 ) {
Fooz c = new Fooz();
public Fooz x;
}
-/*
public class Penguin {
int x;
int y;
p0.y = p1;
p1.y = p0;
}
+
+ static public void m9_( Foo p0, Foo p1 ) {
+ Foo g0 = new Foo();
+
+ p1.x = p1.y;
+ p1.y = g0;
+ }
}
-*/
+
// this empty task should still create a non-empty
Parameter.proof( null, null );
- /*
- int a = 1;
- int b = 2;
- int c = 3;
-
- b = c;
- a = b;
- */
-
taskexit( s{ !initialstate } );
}
-
/*
+
task NewObjectA( Foo a{ f }, Foo b{ f } ) {
Foo c = new Foo();
taskexit( p0{ !f } );
}
-*/
-/*
+
task methodTest01_( Foo p0{ f }, Foo p1{ f } ) {
Foo a0before = new Foo();
taskexit( p0{ !f }, p1{ !f } );
}
-*/
-/*
+
task methodTest02_( Foo p0{ f }, Foo p1{ f } ) {
Foo a0before = new Foo();
a1after.x = new Foo();
}
- Foo.m6_( a0after, a1after );
+ //Foo.m6_( a0after, a1after );
taskexit( p0{ !f }, p1{ !f } );
a1after.x = new Foo();
}
- Foo.m7_( a0after, a1after );
+ //Foo.m7_( a0after, a1after );
taskexit( p0{ !f }, p1{ !f } );
a1after.x = new Foo();
}
- Foo.m8_( a0after, a1after );
+ //Foo.m8_( a0after, a1after );
taskexit( p0{ !f }, p1{ !f } );
}
*/
+
+
+task methodTest09_( Foo p0{ f }, Foo p1{ f } ) {
+
+ Foo a0before = new Foo();
+ if( false ) {
+ a0before.x = new Foo();
+ } else {
+ a0before.x = new Foo();
+ }
+
+ Foo a0after = new Foo();
+ if( false ) {
+ a0after.x = new Foo();
+ } else {
+ a0after.x = new Foo();
+ }
+
+ Foo a1before = new Foo();
+ if( false ) {
+ a1before.x = new Foo();
+ } else {
+ a1before.x = new Foo();
+ }
+
+ Foo a1after = new Foo();
+ if( false ) {
+ a1after.x = new Foo();
+ } else {
+ a1after.x = new Foo();
+ }
+
+ Foo.m9_( a0after, a1after );
+
+
+ taskexit( p0{ !f }, p1{ !f } );
+}
+