public Hashtable<Integer, TokenTuple> paramIndex2paramTokenSecondaryStar;
- public HeapRegionNode hrnNull;
-
-
public OwnershipGraph(int allocationDepth, TypeUtil typeUtil) {
this.allocationDepth = allocationDepth;
this.typeUtil = typeUtil;
paramIndex2paramTokenSecondaryStar = new Hashtable<Integer, TokenTuple >();
allocationSites = new HashSet <AllocationSite>();
-
- hrnNull = createNewHeapRegionNode( OwnershipAnalysis.nullRegionID,
- false,
- false,
- false,
- false,
- null,
- null,
- null,
- "null" );
}
}
- public void assignTempXEqualToNull(TempDescriptor x) {
-
- LabelNode lnX = getLabelNodeFromTemp(x);
-
- clearReferenceEdgesFrom(lnX, null, null, true);
-
- ReferenceEdge edgeNew = new ReferenceEdge(lnX,
- hrnNull,
- null,
- null,
- false,
- null);
-
- addReferenceEdge(lnX, hrnNull, edgeNew);
- }
-
-
public void assignTypedTempXEqualToTempY(TempDescriptor x,
TempDescriptor y,
TypeDescriptor type) {
HeapRegionNode hrnY = edgeY.getDst();
ReachabilitySet betaY = edgeY.getBeta();
- // skip the null region, load statement is not
- // meaningful for this region
- if( hrnY == hrnNull ) {
- continue;
- }
-
Iterator<ReferenceEdge> itrHrnFhrn = hrnY.iteratorToReferencees();
while( itrHrnFhrn.hasNext() ) {
ReferenceEdge edgeHrn = itrHrnFhrn.next();
ReferenceEdge edgeX = itrXhrn.next();
HeapRegionNode hrnX = edgeX.getDst();
- // if we are looking at the null region, skip
- if( hrnX == hrnNull ) {
- continue;
- }
-
// we can do a strong update here if one of two cases holds
if( f != null &&
f != OwnershipAnalysis.getArrayField( f.getType() ) &&
HeapRegionNode hrnX = edgeX.getDst();
ReachabilitySet betaX = edgeX.getBeta();
- // if we are looking at the null region, skip
- if( hrnX == hrnNull ) {
- continue;
- }
-
ReachabilitySet R = hrnX.getAlpha().intersection(edgeX.getBeta() );
Iterator<ReferenceEdge> itrYhrn = lnY.iteratorToReferencees();
ReferenceEdge edgeX = itrXhrn.next();
HeapRegionNode hrnX = edgeX.getDst();
- // if we are looking at the null region, skip
- if( hrnX == hrnNull ) {
- continue;
- }
-
Iterator<ReferenceEdge> itrYhrn = lnY.iteratorToReferencees();
while( itrYhrn.hasNext() ) {
ReferenceEdge edgeY = itrYhrn.next();
assert x != null;
assert as != null;
- age(as);
+ age( as );
// after the age operation the newest (or zero-ith oldest)
// node associated with the allocation site should have
// no references to it as if it were a newly allocated
// heap region
- Integer idNewest = as.getIthOldest(0);
- HeapRegionNode hrnNewest = id2hrn.get(idNewest);
- assert hrnNewest != null;
+ Integer idNewest = as.getIthOldest( 0 );
+ HeapRegionNode hrnNewest = id2hrn.get( idNewest );
+ assert hrnNewest != null;
- LabelNode lnX = getLabelNodeFromTemp(x);
- clearReferenceEdgesFrom(lnX, null, null, true);
+ LabelNode lnX = getLabelNodeFromTemp( x );
+ clearReferenceEdgesFrom( lnX, null, null, true );
// make a new reference to allocated node
TypeDescriptor type = as.getType();
);
addReferenceEdge( lnX, hrnNewest, edgeNew );
-
- // if there are class or array fields, initialize
- // all of them to the null heap region
- if( type.isArray() ) {
- /*
- TypeDescriptor tdElement = type.dereference();
- FieldDescriptor fdElement = OwnershipAnalysis.getArrayField( tdElement );
- ReferenceEdge edgeToNull =
- new ReferenceEdge( hrnNewest, // source
- hrnNull, // dest
- fdElement.getType(), // type
- fdElement.getSymbol(), // field name
- false, // is initial param
- null // beta
- );
- addReferenceEdge( hrnNewest, hrnNull, edgeToNull );
- */
-
- } else if( type.isClass() ) {
- ClassDescriptor cd = type.getClassDesc();
- while( cd != null ) {
-
- Iterator<FieldDescriptor> fieldItr = cd.getFields();
- while( fieldItr.hasNext() ) {
- FieldDescriptor fd = fieldItr.next();
- TypeDescriptor typeField = fd.getType();
-
- assert typeField != null;
-
- ReferenceEdge edgeToNull =
- new ReferenceEdge( hrnNewest, // source
- hrnNull, // dest
- typeField, // type
- typeField.getSymbol(), // field name
- false, // is initial param
- null // beta
- );
-
- addReferenceEdge( hrnNewest, hrnNull, edgeToNull );
- }
-
- cd = cd.getSuperDesc();
- }
- }
}
pi2dr,
pi2r );
- // always remove the null region as a possible source of edges
- possibleCallerSrcs.remove( hrnNull );
-
HashSet<HeapRegionNode> possibleCallerDsts =
getHRNSetThatPossiblyMapToCalleeHRN( ogCallee,
edgeCallee.getDst(),
HashSet<HeapRegionNode> possibleCallerHRNs = new HashSet<HeapRegionNode>();
- if( hrnCallee == ogCallee.hrnNull ) {
- // this is the null heap region
- possibleCallerHRNs.add( id2hrn.get( hrnCallee.getID() ) );
- return possibleCallerHRNs;
- }
-
Set<Integer> paramIndicesCallee_p = ogCallee.idPrimary2paramIndexSet .get( hrnCallee.getID() );
Set<Integer> paramIndicesCallee_s = ogCallee.idSecondary2paramIndexSet.get( hrnCallee.getID() );