From: jjenista Date: Fri, 3 Jun 2011 21:51:35 +0000 (+0000) Subject: fixed a bug where a single argument is passed in as more than one parameter, admittin... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=34d9f4d123797b3156dbefd535b49ff6e771a5d6;p=IRC.git fixed a bug where a single argument is passed in as more than one parameter, admitting only the last such edge --- diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 69539b22..1e7b1b91 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -1706,6 +1706,7 @@ public class DisjointAnalysis implements HeapAnalysis { Set callerNodeIDsCopiedToCallee = new HashSet(); + ReachGraph heapForThisCall_cur = rg.makeCalleeView(fc, fmPossible, @@ -1713,6 +1714,7 @@ public class DisjointAnalysis implements HeapAnalysis { dcsd.writeDebugDOTs ); + // enforce that a call site contribution can only // monotonically increase heapForThisCall_cur.merge(heapForThisCall_old); @@ -2918,6 +2920,7 @@ public class DisjointAnalysis implements HeapAnalysis { state.DISJOINTDEBUGCALLER.equals( taskOrMethodCaller.getSymbol() ); } + dcsd.debugCallSite = debugCalleeMatches && debugCallerMatches; @@ -2945,7 +2948,6 @@ public class DisjointAnalysis implements HeapAnalysis { dcsd.stopAfter = false; if( dcsd.didOneDebug ) { - ++ReachGraph.debugCallSiteVisitCounter; System.out.println(" $$$ Debug call site visit "+ ReachGraph.debugCallSiteVisitCounter+ " $$$" @@ -2968,6 +2970,8 @@ public class DisjointAnalysis implements HeapAnalysis { dcsd.stopAfter = true; } } + + ++ReachGraph.debugCallSiteVisitCounter; } if( dcsd.stopAfter ) { diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 86550e67..7cab6054 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -1786,8 +1786,10 @@ public class ReachGraph { // caller edges from arg vars, and the matching param index // because these become a special edge in callee - Hashtable reachableCallerArgEdges2paramIndex = - new Hashtable(); + // NOTE! One argument may be passed in as more than one parameter, + // so map to a set of parameter indices! + Hashtable< RefEdge, Set > reachableCallerArgEdges2paramIndices = + new Hashtable< RefEdge, Set >(); // caller edges from local vars or callee-unreachable nodes // (out-of-context sources) to callee-reachable nodes @@ -1821,8 +1823,17 @@ public class ReachGraph { if( reCaller.getSrc() instanceof HeapRegionNode ) { reachableCallerEdges.add(reCaller); } else { + if( rsnCaller.equals(vnArgCaller) ) { - reachableCallerArgEdges2paramIndex.put(reCaller, i); + Set pIndices = + reachableCallerArgEdges2paramIndices.get( reCaller ); + + if( pIndices == null ) { + pIndices = new HashSet(); + reachableCallerArgEdges2paramIndices.put( reCaller, pIndices ); + } + pIndices.add( i ); + } else { oocCallerEdges.add(reCaller); } @@ -1837,6 +1848,7 @@ public class ReachGraph { } // end iterating over parameters as starting points + // now collect out-of-callee-context IDs and // map them to whether the ID is out of the caller // context as well @@ -1931,18 +1943,15 @@ public class ReachGraph { // add param edges to callee graph Iterator argEdges = - reachableCallerArgEdges2paramIndex.entrySet().iterator(); + reachableCallerArgEdges2paramIndices.entrySet().iterator(); while( argEdges.hasNext() ) { - Map.Entry me = (Map.Entry)argEdges.next(); - RefEdge reArg = (RefEdge) me.getKey(); - Integer index = (Integer) me.getValue(); + Map.Entry me = (Map.Entry) argEdges.next(); + RefEdge reArg = (RefEdge) me.getKey(); + Set pInxs = (Set) me.getValue(); - VariableNode vnCaller = (VariableNode) reArg.getSrc(); + VariableNode vnCaller = (VariableNode) reArg.getSrc(); TempDescriptor argCaller = vnCaller.getTempDescriptor(); - TempDescriptor paramCallee = fmCallee.getParameter(index); - VariableNode vnCallee = rg.getVariableNodeFromTemp(paramCallee); - HeapRegionNode hrnDstCaller = reArg.getDst(); HeapRegionNode hrnDstCallee = rg.id2hrn.get(hrnDstCaller.getID() ); assert hrnDstCallee != null; @@ -1962,24 +1971,30 @@ public class ReachGraph { ExistPredSet preds = ExistPredSet.factory(pred); - RefEdge reCallee = - new RefEdge(vnCallee, - hrnDstCallee, - reArg.getType(), - reArg.getField(), - toCalleeContext(reArg.getBeta(), - preds, - oocHrnIdOoc2callee - ), - preds, - toCalleeContext(reArg.getTaints(), - preds) - ); + for( Integer index: pInxs ) { - rg.addRefEdge(vnCallee, - hrnDstCallee, - reCallee - ); + TempDescriptor paramCallee = fmCallee.getParameter(index); + VariableNode vnCallee = rg.getVariableNodeFromTemp(paramCallee); + + RefEdge reCallee = + new RefEdge(vnCallee, + hrnDstCallee, + reArg.getType(), + reArg.getField(), + toCalleeContext(reArg.getBeta(), + preds, + oocHrnIdOoc2callee + ), + preds, + toCalleeContext(reArg.getTaints(), + preds) + ); + + rg.addRefEdge(vnCallee, + hrnDstCallee, + reCallee + ); + } } // add in-context edges to callee graph diff --git a/Robust/src/Benchmarks/oooJava/master-makefile b/Robust/src/Benchmarks/oooJava/master-makefile index 797e0556..6d4be320 100644 --- a/Robust/src/Benchmarks/oooJava/master-makefile +++ b/Robust/src/Benchmarks/oooJava/master-makefile @@ -77,10 +77,12 @@ DISJOINT= -disjoint -disjoint-k 1 -enable-assertions $(DRELEASEMODE) #-disjoint- # -disjoint-debug-snap-method Remove 10 3 true DISJOINTDEBUG= -disjoint -disjoint-k 1 -enable-assertions +# -disjoint-debug-callsite RayTracer.trace RayTracer.shade 10000 1 true # -disjoint-write-dots final \ # -flatirusermethods \ -# -disjoint-debug-callsite System.println Barneshut.run 1 1000 true \ -# -disjoint-debug-snap-method Barneshut.run 1 1000 false +# -disjoint-write-ihms \ +# -disjoint-write-initial-contexts \ +# -disjoint-debug-snap-method RayTracer.shade 300 999 true # -disjoint-debug-snap-method String.indexOf 1 1000 true # -disjoint-debug-callsite String.concat2 FileInputStream.readLine 1 1000 true \ # -disjoint-debug-snap-method String.concat2 1 1000 true @@ -89,9 +91,7 @@ DISJOINTDEBUG= -disjoint -disjoint-k 1 -enable-assertions # # -justanalyze \ # -disjoint-debug-callsite String.toString String.valueOf 1 1000 true \ -# -disjoint-write-initial-contexts \ # -disjoint-debug-scheduling \ -# -disjoint-write-ihms # -disjoint-desire-determinism # -disjoint-debug-callsite Demand.add Lateral.compute 1 1000 true # -disjoint-debug-snap-method ComputeCenterOfMass 6 2 true