protected static final boolean DISABLE_STRONG_UPDATES = false;
protected static final boolean DISABLE_GLOBAL_SWEEP = false;
- // a special out-of-scope temp
- protected static final TempDescriptor tdReturn = new TempDescriptor("_Return___");
+ // a special out-of-scope temps
+ protected static TempDescriptor tdReturn;
+ protected static TempDescriptor tdStrLiteralBytes;
+
+ public static void initOutOfScopeTemps() {
+ tdReturn = new TempDescriptor("_Return___");
+
+ tdStrLiteralBytes =
+ new TempDescriptor("_strLiteralBytes___",
+ new TypeDescriptor(TypeDescriptor.CHAR).makeArray( state )
+ );
+ }
// predicate constants
public static final ExistPred predTrue = ExistPred.factory(); // if no args, true
//
////////////////////////////////////////////////////
+ public void assignTempEqualToStringLiteral(TempDescriptor x,
+ AllocSite asStringLiteral,
+ AllocSite asStringLiteralBytes,
+ FieldDescriptor fdStringBytesField) {
+ // model this to get points-to information right for
+ // pointers to string literals, even though it doesn't affect
+ // reachability paths in the heap
+ assignTempEqualToNewAlloc( x,
+ asStringLiteral );
+
+ assignTempEqualToNewAlloc( tdStrLiteralBytes,
+ asStringLiteralBytes );
+
+ assignTempXFieldFEqualToTempY( x,
+ fdStringBytesField,
+ tdStrLiteralBytes,
+ null );
+ }
+
+
public void assignTempXEqualToTempY(TempDescriptor x,
TempDescriptor y) {
assignTempXEqualToCastedTempY(x, y, null);
public Set<Alloc> canPointTo( TempDescriptor x ) {
- VariableNode vn = getVariableNodeNoMutation( x );
- if( vn == null ) {
- return null;
+
+ if( !DisjointAnalysis.shouldAnalysisTrack( x.getType() ) ) {
+ // if we don't care to track it, return null which means
+ // "a client of this result shouldn't care either"
+ return HeapAnalysis.DONTCARE_PTR;
}
Set<Alloc> out = new HashSet<Alloc>();
+ VariableNode vn = getVariableNodeNoMutation( x );
+ if( vn == null ) {
+ // the empty set means "can't point to anything"
+ return out;
+ }
+
Iterator<RefEdge> edgeItr = vn.iteratorToReferencees();
while( edgeItr.hasNext() ) {
HeapRegionNode hrn = edgeItr.next().getDst();
-
out.add( hrn.getAllocSite() );
}
public Hashtable< Alloc, Set<Alloc> > canPointTo( TempDescriptor x,
- String field ) {
+ String field,
+ TypeDescriptor fieldType ) {
+
+ if( !DisjointAnalysis.shouldAnalysisTrack( x.getType() ) ) {
+ // if we don't care to track it, return null which means
+ // "a client of this result shouldn't care either"
+ return HeapAnalysis.DONTCARE_DREF;
+ }
+
+ Hashtable< Alloc, Set<Alloc> > out = new Hashtable< Alloc, Set<Alloc> >();
VariableNode vn = getVariableNodeNoMutation( x );
if( vn == null ) {
- return null;
+ // the empty table means "x can't point to anything"
+ return out;
}
- Hashtable< Alloc, Set<Alloc> > out = new Hashtable< Alloc, Set<Alloc> >();
-
Iterator<RefEdge> edgeItr = vn.iteratorToReferencees();
while( edgeItr.hasNext() ) {
HeapRegionNode hrn = edgeItr.next().getDst();
+ Alloc key = hrn.getAllocSite();
- Alloc key = hrn.getAllocSite();
+ if( !DisjointAnalysis.shouldAnalysisTrack( fieldType ) ) {
+ // if we don't care to track it, put no entry which means
+ // "a client of this result shouldn't care either"
+ out.put( key, HeapAnalysis.DONTCARE_PTR );
+ continue;
+ }
Set<Alloc> moreValues = new HashSet<Alloc>();
Iterator<RefEdge> edgeItr2 = hrn.iteratorToReferencees();