public TokenTupleSet getSetToAdd() { return toAdd; }
public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
+
if( !(o instanceof ChangeTuple) ) {
return false;
}
}
public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
+
if( !(o instanceof ChangeTupleSet) ) {
return false;
}
public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
if( !( o instanceof HeapRegionNode) ) {
return false;
}
public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
if( !( o instanceof LabelNode) ) {
return false;
return td.getNum();
}
+
public String getTempDescriptorString() {
return td.toString();
}
ReachabilitySet beta2 = rep2.getBeta();
ReferenceEdgeProperties rep =
- new ReferenceEdgeProperties( false,
+ new ReferenceEdgeProperties( null,
false,
beta1.intersection( beta2 ) );
// finally, create the actual reference edge hrn->hrnSrc
ReferenceEdgeProperties repNew
- = new ReferenceEdgeProperties( false,
+ = new ReferenceEdgeProperties( fd,
false,
repSrc.getBetaNew().pruneBy( hrn.getAlpha() )
);
// and have a reference to themselves, because we can't know the
// structure of memory that is passed into the method. We're assuming
// the worst here.
- addReferenceEdge( lnParam, hrn, new ReferenceEdgeProperties( false, false, beta ) );
- addReferenceEdge( hrn, hrn, new ReferenceEdgeProperties( false, true, beta ) );
+ addReferenceEdge( lnParam, hrn, new ReferenceEdgeProperties( null, false, beta ) );
+ addReferenceEdge( hrn, hrn, new ReferenceEdgeProperties( null, true, beta ) );
}
public void assignTempToNewAllocation( TempDescriptor td,
clearReferenceEdgesFrom( dst );
- addReferenceEdge( dst, hrnNewest, new ReferenceEdgeProperties( false, false, hrnNewest.getAlpha() ) );
+ addReferenceEdge( dst, hrnNewest, new ReferenceEdgeProperties( null, false, hrnNewest.getAlpha() ) );
}
AllocationSite allocSite = i.next();
HeapRegionNode hrnSummary = getSummaryNode ( allocSite );
HeapRegionNode hrnShadowSummary = getShadowSummaryNode( allocSite );
- }
-
-
-
- /*
+ }
// in non-static methods there is a "this" pointer
// that should be taken into account
// and a set of destination heaps in the caller graph, and make
// a reference edge in the caller for every possible (src,dst) pair
if( !ogCallee.id2hrn.contains( idChildCallee ) ) {
- //System.out.println( "Houston, we got a problem." );
- //System.out.println( "idCallee is "+idCallee );
- //System.out.println( "idChildCallee is "+idChildCallee );
+ System.out.println( "Houston, we got a problem." );
+ System.out.println( "idCallee is "+idCallee );
+ System.out.println( "idChildCallee is "+idChildCallee );
try {
- writeGraph( "caller", false, false, false );
- ogCallee.writeGraph( "callee", false, false, false );
+ writeGraph ( "caller", false, false, false, false );
+ ogCallee.writeGraph( "callee", false, false, false, false );
} catch( IOException e ) {}
}
}
}
}
- */
}
+
private HashSet<HeapRegionNode> getHRNSetThatPossiblyMapToCalleeHRN( OwnershipGraph ogCallee,
Integer idCallee,
FlatCall fc,
import IR.Flat.*;
import java.util.*;
-public class OwnershipNode {
+public abstract class OwnershipNode {
+
+ protected Hashtable <HeapRegionNode, ReferenceEdgeProperties> referencedRegions;
public OwnershipNode() {
referencedRegions =
}
- ///////////////////////////////////////////
- // interface with larger graph
- ///////////////////////////////////////////
- protected Hashtable
- <HeapRegionNode, ReferenceEdgeProperties>
- referencedRegions;
-
public Iterator setIteratorToReferencedRegions() {
Set s = referencedRegions.entrySet();
return s.iterator();
return referencedRegions.get( hrn );
}
- ///////////////////////////////////////////////
- // end interface with larger graph
- ///////////////////////////////////////////////
+
+
+ abstract public boolean equals( Object o );
+ abstract public int hashCode();
}
\ No newline at end of file
public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
+
if( !(o instanceof ReachabilitySet) ) {
return false;
}
package Analysis.OwnershipAnalysis;
+import IR.*;
+import IR.Flat.*;
+
+
public class ReferenceEdgeProperties {
- protected boolean isUnique;
+ // a null field descriptor means "any field"
+ protected FieldDescriptor fieldDesc;
+
protected boolean isInitialParamReflexive;
protected ReachabilitySet beta;
protected HeapRegionNode dst;
public ReferenceEdgeProperties() {
- this( false, false, null );
+ this( null, false, null );
}
- public ReferenceEdgeProperties( boolean isUnique ) {
- this( isUnique, false, null );
- }
-
- public ReferenceEdgeProperties( boolean isUnique,
- boolean isInitialParamReflexive ) {
- this( isUnique, isInitialParamReflexive, null );
- }
-
- public ReferenceEdgeProperties( boolean isUnique,
+ public ReferenceEdgeProperties( FieldDescriptor fieldDesc,
boolean isInitialParamReflexive,
- ReachabilitySet beta) {
- this.isUnique = isUnique;
- this.isInitialParamReflexive = isInitialParamReflexive;
+ ReachabilitySet beta ) {
- // these members are set by higher-level code
- // when this ReferenceEdgeProperties object is
- // applied to an edge
- this.src = null;
- this.dst = null;
+ this.fieldDesc = fieldDesc;
+ this.isInitialParamReflexive = isInitialParamReflexive;
if( beta != null ) {
this.beta = beta;
this.beta = this.beta.makeCanonical();
}
+ // these members are set by higher-level code
+ // when this ReferenceEdgeProperties object is
+ // applied to an edge
+ this.src = null;
+ this.dst = null;
+
+ // when edges are not undergoing a transitional operation
+ // that is changing beta info, betaNew is always empty
betaNew = new ReachabilitySet();
betaNew = betaNew.makeCanonical();
}
}
- // copying does not copy source and destination members!
+ // copying does not copy source and destination members! or betaNew
public ReferenceEdgeProperties copy() {
- return new ReferenceEdgeProperties( isUnique,
+ return new ReferenceEdgeProperties( fieldDesc,
isInitialParamReflexive,
beta );
}
-
- public boolean isUnique() {
- return isUnique;
+ public FieldDescriptor getFieldDesc() {
+ return fieldDesc;
}
- public void setIsUnique( boolean isUnique ) {
- this.isUnique = isUnique;
+
+ public void setFieldDesc( FieldDescriptor fieldDesc ) {
+ this.fieldDesc = fieldDesc;
}
}
-
public ReachabilitySet getBeta() {
return beta;
}
}
- public boolean equals( ReferenceEdgeProperties rep ) {
- assert rep != null;
+ public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
+
+ if( !(o instanceof ReferenceEdgeProperties) ) {
+ return false;
+ }
- return isUnique == rep.isUnique() &&
- isInitialParamReflexive == rep.isInitialParamReflexive();
+ ReferenceEdgeProperties rep = (ReferenceEdgeProperties) o;
+
+ // field descriptors maintain the invariant that they are reference comparable
+ return fieldDesc == rep.fieldDesc &&
+ isInitialParamReflexive == rep.isInitialParamReflexive &&
+ beta.equals( rep.beta );
}
+ public int hashCode() {
+ int hash = 0;
+ if( fieldDesc != null ) {
+ hash += fieldDesc.getType().hashCode();
+ }
+ hash += beta.hashCode();
+ return hash;
+ }
+
+
public String getBetaString() {
return beta.toStringEscapeNewline();
}
public String toEdgeLabelString() {
String edgeLabel = "";
- /*
- if( rep.isUnique() ) {
- edgeLabel += "Unq";
+ if( fieldDesc != null ) {
+ edgeLabel += fieldDesc.toStringBrief() + "\\n";
}
- */
if( isInitialParamReflexive ) {
edgeLabel += "Rflx\\n";
}
}
public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
+
if( !(o instanceof TokenTuple) ) {
return false;
}
}
public boolean equals( Object o ) {
+ if( o == null ) {
+ return false;
+ }
+
if( !(o instanceof TokenTupleSet) ) {
return false;
}
a.x = b.x;
}
- public void test( Foo p0, Foo p1 ) {
+ static public void test( Foo p0, Foo p1 ) {
Foo f0 = new Foo();
Foo f1 = new Foo();
Foo f2 = new Foo();
b = c;
}
*/
-
- Foo aa = new Foo();
- aa.test( aa, aa );
-
- /*
- Foo ab = new Foo();
- Foo ac = new Foo();
- Foo ad = new Foo();
+ /*
aa.x = ab;
ab.x = ac;
ab.x = aa;
taskexit( s{ !initialstate } );
}
+
+task methodTest( Foo p0{ f } ) {
+
+ Foo a0;
+ if( false ) {
+ a0 = new Foo();
+ } else {
+ a0 = new Foo();
+ a0.x = new Foo();
+ p0.x = a0;
+ }
+
+ Foo a1 = new Foo();
+
+ if( false ) {
+ p0.x = a1;
+ }
+
+ Foo.test( a0, a1 );
+
+ taskexit( p0{ !f } );
+}
+
/*
task NewObject( Foo a{ f }, Foo b{ f } ) {