if( !rg.equals( rgPrev ) ) {
setPartial( d, rg );
+ /*
+ if( d.getSymbol().equals( "getInterpolatePatch" ) ) {
+ ReachGraph.dbgEquals = true;
+ rg.equals( rgPrev );
+ ReachGraph.dbgEquals = false;
+ }
+ */
+
// results for d changed, so enqueue dependents
// of d for further analysis
Iterator<Descriptor> depsItr = getDependents( d ).iterator();
lhs = ffn.getDst();
rhs = ffn.getSrc();
fld = ffn.getField();
- if( !fld.getType().isImmutable() || fld.getType().isArray() ) {
+ if( shouldAnalysisTrack( fld.getType() ) ) {
rg.assignTempXEqualToTempYFieldF( lhs, rhs, fld );
}
break;
lhs = fsfn.getDst();
fld = fsfn.getField();
rhs = fsfn.getSrc();
- if( !fld.getType().isImmutable() || fld.getType().isArray() ) {
+ if( shouldAnalysisTrack( fld.getType() ) ) {
rg.assignTempXFieldFEqualToTempY( lhs, fld, rhs );
}
break;
FlatElementNode fen = (FlatElementNode) fn;
lhs = fen.getDst();
rhs = fen.getSrc();
- if( !lhs.getType().isImmutable() || lhs.getType().isArray() ) {
+ if( shouldAnalysisTrack( lhs.getType() ) ) {
assert rhs.getType() != null;
assert rhs.getType().isArray();
lhs = fsen.getDst();
rhs = fsen.getSrc();
- if( !rhs.getType().isImmutable() || rhs.getType().isArray() ) {
+ if( shouldAnalysisTrack( rhs.getType() ) ) {
assert lhs.getType() != null;
assert lhs.getType().isArray();
case FKind.FlatNew:
FlatNew fnn = (FlatNew) fn;
lhs = fnn.getDst();
- if( !lhs.getType().isImmutable() || lhs.getType().isArray() ) {
+ if( shouldAnalysisTrack( lhs.getType() ) ) {
AllocSite as = getAllocSiteFromFlatNewPRIVATE( fnn );
rg.assignTempEqualToNewAlloc( lhs, as );
}
case FKind.FlatReturnNode:
FlatReturnNode frn = (FlatReturnNode) fn;
rhs = frn.getReturnTemp();
- if( rhs != null && !rhs.getType().isImmutable() ) {
+ if( rhs != null && shouldAnalysisTrack( rhs.getType() ) ) {
rg.assignReturnEqualToTemp( rhs );
}
setRetNodes.add( frn );
}
+ public static boolean shouldAnalysisTrack( TypeDescriptor type ) {
+ // don't track primitive types, but an array
+ // of primitives is heap memory
+ if( type.isImmutable() ) {
+ return type.isArray();
+ }
+
+ // everything else is an object
+ return true;
+ }
+
+
/*
// return all allocation sites in the method (there is one allocation
// site per FlatNew node in a method)
for (Iterator it = classDesc.getFields(); it.hasNext();) {
FieldDescriptor fd = (FieldDescriptor) it.next();
TypeDescriptor fieldType = fd.getType();
- if (!fieldType.isImmutable() || fieldType.isArray()) {
+ if (shouldAnalysisTrack( fieldType )) {
HashMap<HeapRegionNode, FieldDescriptor> newMap = new HashMap<HeapRegionNode, FieldDescriptor>();
newMap.put(hrnNewest, fd);
workSet.add(newMap);
for( int i = 0; i < fmCallee.numParameters(); ++i ) {
// parameter defined here is the symbol in the callee
- TempDescriptor tdParam = fmCallee.getParameter( i );
- VariableNode vnCallee = rgCallee.getVariableNodeFromTemp( tdParam );
+ TempDescriptor tdParam = fmCallee.getParameter( i );
+
+ if( !DisjointAnalysis.shouldAnalysisTrack( tdParam.getType() ) ) {
+ // skip primitive/immutable parameters
+ continue;
+ }
+
+ VariableNode vnCallee = rgCallee.getVariableNodeFromTemp( tdParam );
Iterator<RefEdge> reItr = vnCallee.iteratorToReferencees();
while( reItr.hasNext() ) {
// 3.d) handle return value assignment if needed
TempDescriptor returnTemp = fc.getReturnTemp();
- if( returnTemp != null && !returnTemp.getType().isImmutable() ) {
+ if( returnTemp != null &&
+ DisjointAnalysis.shouldAnalysisTrack( returnTemp.getType() )
+ ) {
VariableNode vnLhsCaller = getVariableNodeFromTemp( returnTemp );
clearRefEdgesFrom( vnLhsCaller, null, null, true );
}
+
+ static boolean dbgEquals = false;
+
+
// it is necessary in the equals() member functions
// to "check both ways" when comparing the data
// structures of two graphs. For instance, if all
public boolean equals( ReachGraph rg ) {
if( rg == null ) {
+ if( dbgEquals ) {
+ System.out.println( "rg is null" );
+ }
return false;
}
if( !areHeapRegionNodesEqual( rg ) ) {
+ if( dbgEquals ) {
+ System.out.println( "hrn not equal" );
+ }
return false;
}
if( !areVariableNodesEqual( rg ) ) {
+ if( dbgEquals ) {
+ System.out.println( "vars not equal" );
+ }
return false;
}
if( !areRefEdgesEqual( rg ) ) {
+ if( dbgEquals ) {
+ System.out.println( "edges not equal" );
+ }
return false;
}