From: bdemsky Date: Thu, 25 Mar 2010 22:15:29 +0000 (+0000) Subject: bug fixes and optimizations X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5eb2739ca5c78839fd2c4f072cf3709e5cbc26bb;p=IRC.git bug fixes and optimizations --- diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 48724298..da618c50 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -429,6 +429,8 @@ public class DisjointAnalysis { protected Hashtable mapDescriptorToReachGraph; + protected PointerMethod pm; + // allocate various structures that are not local // to a single class method--should be done once @@ -512,6 +514,8 @@ public class DisjointAnalysis { 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; @@ -656,7 +660,7 @@ public class DisjointAnalysis { } else { fm = state.getMethodFlat( d ); } - + pm.analyzeMethod(fm); // intraprocedural work set Set flatNodesToVisit = new HashSet(); flatNodesToVisit.add( fm ); @@ -692,8 +696,8 @@ public class DisjointAnalysis { } // 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 ); @@ -727,8 +731,8 @@ public class DisjointAnalysis { 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 ); } } @@ -1888,6 +1892,7 @@ private void buildAllocationSiteSet(Descriptor d) { 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 @@ -1906,8 +1911,8 @@ private void buildAllocationSiteSet(Descriptor d) { 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); } diff --git a/Robust/src/Analysis/Disjoint/PointerMethod.java b/Robust/src/Analysis/Disjoint/PointerMethod.java index 19ab62b6..c7b1d919 100644 --- a/Robust/src/Analysis/Disjoint/PointerMethod.java +++ b/Robust/src/Analysis/Disjoint/PointerMethod.java @@ -26,7 +26,8 @@ public class PointerMethod { HashSet myset=new HashSet(); if (!analysisCares(fn)) { for(int i=0;i vfn=nextmap.get(fn); + if (vfn==null) + return 0; + else + return vfn.size(); } public FlatNode getNext(FlatNode fn, int i) {