// caller edges from arg vars, and the matching param index
// because these become a special edge in callee
- Hashtable<RefEdge, Integer> reachableCallerArgEdges2paramIndex =
- new Hashtable<RefEdge, Integer>();
+ // NOTE! One argument may be passed in as more than one parameter,
+ // so map to a set of parameter indices!
+ Hashtable< RefEdge, Set<Integer> > reachableCallerArgEdges2paramIndices =
+ new Hashtable< RefEdge, Set<Integer> >();
// caller edges from local vars or callee-unreachable nodes
// (out-of-context sources) to callee-reachable nodes
if( reCaller.getSrc() instanceof HeapRegionNode ) {
reachableCallerEdges.add(reCaller);
} else {
+
if( rsnCaller.equals(vnArgCaller) ) {
- reachableCallerArgEdges2paramIndex.put(reCaller, i);
+ Set<Integer> pIndices =
+ reachableCallerArgEdges2paramIndices.get( reCaller );
+
+ if( pIndices == null ) {
+ pIndices = new HashSet<Integer>();
+ reachableCallerArgEdges2paramIndices.put( reCaller, pIndices );
+ }
+ pIndices.add( i );
+
} else {
oocCallerEdges.add(reCaller);
}
} // 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
// 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<Integer> pInxs = (Set<Integer>) 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;
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
# -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
#
# -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