use of org.apache.bcel.generic.Type in project jop by jop-devel.
the class MethodCacheAnalysis method getMissCost.
/**
* Get miss cost for an edge accessing the method cache
* @param accessEdge either a SuperInvoke or SuperReturn edge, or an entry edge of the segment analyzed
* @return maximum miss penalty (in cycles)
*/
private long getMissCost(SuperGraphEdge accessEdge) {
SuperGraphNode accessed = accessEdge.getTarget();
ControlFlowGraph cfg = accessed.getCfg();
if (accessEdge instanceof SuperReturnEdge) {
/* return edge: return cost */
Type returnType = accessEdge.getSource().getCfg().getMethodInfo().getType();
return methodCache.getMissPenaltyOnReturn(cfg.getNumberOfWords(), returnType);
} else if (accessEdge instanceof SuperInvokeEdge) {
InstructionHandle invokeIns = ((SuperInvokeEdge) accessEdge).getInvokeNode().getInvokeSite().getInstructionHandle();
return methodCache.getMissPenaltyOnInvoke(cfg.getNumberOfWords(), invokeIns.getInstruction());
} else {
/* entry edge of the segment: can be invoke or return cost */
return methodCache.getMissPenalty(cfg.getNumberOfWords(), false);
}
}
Aggregations