From e02df5ea1c472749a8b8535c87f9066e8417b71b Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 17 Sep 2009 22:08:35 +0000 Subject: [PATCH] explicit null heap region changes rolled back --- .../OwnershipAnalysis/OwnershipAnalysis.java | 17 +-- .../OwnershipAnalysis/OwnershipGraph.java | 116 +----------------- 2 files changed, 7 insertions(+), 126 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java index f1d1d1c6..97cc05be 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java @@ -313,11 +313,6 @@ public class OwnershipAnalysis { // reserved IDs for special purposes static private int uniqueIDcount = 10; - // special purpose region for "null" - // included in every graph - static public int nullRegionID = 9; - - // Use these data structures to track progress of // processing all methods in the program, and by methods // TaskDescriptor and MethodDescriptor are combined @@ -760,17 +755,7 @@ public class OwnershipAnalysis { og.merge(ogInitParamAlloc); } break; - - case FKind.FlatLiteralNode: - FlatLiteralNode fln = (FlatLiteralNode) fn; - if( fln.getValue() == null ) { - // when we set something to null, use the special - // "null" heap region as the target - lhs = fln.getDst(); - og.assignTempXEqualToNull(lhs); - } - break; - + case FKind.FlatOpNode: FlatOpNode fon = (FlatOpNode) fn; if( fon.getOp().getOp() == Operation.ASSIGN ) { diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 9a0faf11..717b612c 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -67,9 +67,6 @@ public class OwnershipGraph { public Hashtable paramIndex2paramTokenSecondaryStar; - public HeapRegionNode hrnNull; - - public OwnershipGraph(int allocationDepth, TypeUtil typeUtil) { this.allocationDepth = allocationDepth; this.typeUtil = typeUtil; @@ -94,16 +91,6 @@ public class OwnershipGraph { paramIndex2paramTokenSecondaryStar = new Hashtable(); allocationSites = new HashSet (); - - hrnNull = createNewHeapRegionNode( OwnershipAnalysis.nullRegionID, - false, - false, - false, - false, - null, - null, - null, - "null" ); } @@ -321,23 +308,6 @@ public class OwnershipGraph { } - 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) { @@ -375,12 +345,6 @@ public class OwnershipGraph { 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 itrHrnFhrn = hrnY.iteratorToReferencees(); while( itrHrnFhrn.hasNext() ) { ReferenceEdge edgeHrn = itrHrnFhrn.next(); @@ -423,11 +387,6 @@ public class OwnershipGraph { 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() ) && @@ -447,11 +406,6 @@ public class OwnershipGraph { 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 itrYhrn = lnY.iteratorToReferencees(); @@ -506,11 +460,6 @@ public class OwnershipGraph { ReferenceEdge edgeX = itrXhrn.next(); HeapRegionNode hrnX = edgeX.getDst(); - // if we are looking at the null region, skip - if( hrnX == hrnNull ) { - continue; - } - Iterator itrYhrn = lnY.iteratorToReferencees(); while( itrYhrn.hasNext() ) { ReferenceEdge edgeY = itrYhrn.next(); @@ -1197,18 +1146,18 @@ public class OwnershipGraph { 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(); @@ -1222,50 +1171,6 @@ public class OwnershipGraph { ); 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 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(); - } - } } @@ -2808,9 +2713,6 @@ public class OwnershipGraph { pi2dr, pi2r ); - // always remove the null region as a possible source of edges - possibleCallerSrcs.remove( hrnNull ); - HashSet possibleCallerDsts = getHRNSetThatPossiblyMapToCalleeHRN( ogCallee, edgeCallee.getDst(), @@ -3312,12 +3214,6 @@ public class OwnershipGraph { HashSet possibleCallerHRNs = new HashSet(); - if( hrnCallee == ogCallee.hrnNull ) { - // this is the null heap region - possibleCallerHRNs.add( id2hrn.get( hrnCallee.getID() ) ); - return possibleCallerHRNs; - } - Set paramIndicesCallee_p = ogCallee.idPrimary2paramIndexSet .get( hrnCallee.getID() ); Set paramIndicesCallee_s = ogCallee.idSecondary2paramIndexSet.get( hrnCallee.getID() ); -- 2.34.1