protected Hashtable<Descriptor, ReachGraph>
mapDescriptorToReachGraph;
+ protected PointerMethod pm;
+
// allocate various structures that are not local
// to a single class method--should be done once
this.stopAfterCapture = state.DISJOINTSNAPSTOPAFTER;
this.snapVisitCounter = 1; // count visits from 1 (user will write 1, means 1st visit)
this.snapNodeCounter = 0; // count nodes from 0
+ this.pm=new PointerMethod();
+
// set some static configuration for ReachGraphs
ReachGraph.allocationDepth = allocationDepth;
} else {
fm = state.getMethodFlat( d );
}
-
+ pm.analyzeMethod(fm);
// intraprocedural work set
Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
flatNodesToVisit.add( fm );
}
// start by merging all node's parents' graphs
- for( int i = 0; i < fn.numPrev(); ++i ) {
- FlatNode pn = fn.getPrev( i );
+ for( int i = 0; i < pm.numPrev(fn); ++i ) {
+ FlatNode pn = pm.getPrev(fn,i);
if( mapFlatNodeToReachGraph.containsKey( pn ) ) {
ReachGraph rgParent = mapFlatNodeToReachGraph.get( pn );
rg.merge( rgParent );
if( !rg.equals( rgPrev ) ) {
mapFlatNodeToReachGraph.put( fn, rg );
- for( int i = 0; i < fn.numNext(); i++ ) {
- FlatNode nn = fn.getNext( i );
+ for( int i = 0; i < pm.numNext(fn); i++ ) {
+ FlatNode nn = pm.getNext(fn, i);
flatNodesToVisit.add( nn );
}
}
assert d instanceof TaskDescriptor;
fm = state.getMethodFlat( (TaskDescriptor) d);
}
+ pm.analyzeMethod(fm);
// visit every node in this FlatMethod's IR graph
// and make a set of the allocation sites from the
toVisit.remove(n);
visited.add(n);
- for( int i = 0; i < n.numNext(); ++i ) {
- FlatNode child = n.getNext(i);
+ for( int i = 0; i < pm.numNext(n); ++i ) {
+ FlatNode child = pm.getNext(n, i);
if( !visited.contains(child) ) {
toVisit.add(child);
}
HashSet<FlatNode> myset=new HashSet<FlatNode>();
if (!analysisCares(fn)) {
for(int i=0;i<fn.numPrev();i++) {
- myset.addAll(map.get(fn.getPrev(i)));
+ if (map.containsKey(fn.getPrev(i)))
+ myset.addAll(map.get(fn.getPrev(i)));
}
} else {
myset.add(fn);
}
public int numNext(FlatNode fn) {
- return nextmap.get(fn).size();
+ Vector<FlatNode> vfn=nextmap.get(fn);
+ if (vfn==null)
+ return 0;
+ else
+ return vfn.size();
}
public FlatNode getNext(FlatNode fn, int i) {