use of org.jikesrvm.adaptive.util.UnResolvedWeightedCallTargets in project JikesRVM by JikesRVM.
the class PartialCallGraph method getCallTargets.
/**
* @param caller caller method
* @param bcIndex bytecode index in caller method
* @return the WeightedCallTargets currently associated with the
* given caller bytecodeIndex pair.
*/
public WeightedCallTargets getCallTargets(RVMMethod caller, int bcIndex) {
MethodReference callerRef = caller.getMemberRef().asMethodReference();
UnResolvedWeightedCallTargets unresolvedTargets = unresolvedCallGraph.get(new UnResolvedCallSite(callerRef, bcIndex));
if (unresolvedTargets != null) {
final RVMMethod fCaller = caller;
final int fBcIndex = bcIndex;
final PartialCallGraph pg = this;
unresolvedTargets.visitTargets(new UnResolvedWeightedCallTargets.Visitor() {
@Override
public void visit(MethodReference calleeRef, double weight) {
RVMMethod callee = calleeRef.getResolvedMember();
if (callee != null) {
pg.incrementEdge(fCaller, fBcIndex, callee, (float) weight);
}
}
});
}
return getCallTargets(new CallSite(caller, bcIndex));
}
use of org.jikesrvm.adaptive.util.UnResolvedWeightedCallTargets in project JikesRVM by JikesRVM.
the class PartialCallGraph method incrementUnResolvedEdge.
/**
* For the calling edge we read from a profile, we may not have
* the methods loaded in yet. Therefore, we will record the method
* reference information first, the next time we resolved the method,
* we will promote it into the regular call graph.
* Increment the edge represented by the input parameters,
* creating it if it is not already in the call graph.
*
* @param callerRef method making the call
* @param bcIndex call site, if -1 then no call site is specified.
* @param calleeRef method called
* @param weight the frequency of this calling edge
*/
public synchronized void incrementUnResolvedEdge(MethodReference callerRef, int bcIndex, MethodReference calleeRef, float weight) {
UnResolvedCallSite callSite = new UnResolvedCallSite(callerRef, bcIndex);
UnResolvedWeightedCallTargets targets = unresolvedCallGraph.get(callSite);
if (targets == null) {
targets = UnResolvedWeightedCallTargets.create(calleeRef, weight);
unresolvedCallGraph.put(callSite, targets);
} else {
UnResolvedWeightedCallTargets orig = targets;
targets = targets.augmentCount(calleeRef, weight);
if (orig != targets) {
unresolvedCallGraph.put(callSite, targets);
}
}
}
Aggregations