Search in sources :

Example 21 with Type

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);
    }
}
Also used : Type(org.apache.bcel.generic.Type) ControlFlowGraph(com.jopdesign.common.code.ControlFlowGraph) SuperReturnEdge(com.jopdesign.common.code.SuperGraph.SuperReturnEdge) SuperGraphNode(com.jopdesign.common.code.SuperGraph.SuperGraphNode) InstructionHandle(org.apache.bcel.generic.InstructionHandle) SuperInvokeEdge(com.jopdesign.common.code.SuperGraph.SuperInvokeEdge)

Aggregations

Type (org.apache.bcel.generic.Type)21 FieldInstruction (org.apache.bcel.generic.FieldInstruction)7 InstructionHandle (org.apache.bcel.generic.InstructionHandle)7 InvokeInstruction (org.apache.bcel.generic.InvokeInstruction)7 GETFIELD (org.apache.bcel.generic.GETFIELD)6 Instruction (org.apache.bcel.generic.Instruction)6 ObjectType (org.apache.bcel.generic.ObjectType)6 PUTFIELD (org.apache.bcel.generic.PUTFIELD)6 ReferenceType (org.apache.bcel.generic.ReferenceType)6 InstructionList (org.apache.bcel.generic.InstructionList)5 CallString (com.jopdesign.common.code.CallString)4 Context (com.jopdesign.dfa.framework.Context)4 ContextMap (com.jopdesign.dfa.framework.ContextMap)4 BranchInstruction (org.apache.bcel.generic.BranchInstruction)4 GETSTATIC (org.apache.bcel.generic.GETSTATIC)4 LoadInstruction (org.apache.bcel.generic.LoadInstruction)4 PUTSTATIC (org.apache.bcel.generic.PUTSTATIC)4 StoreInstruction (org.apache.bcel.generic.StoreInstruction)4 MethodInfo (com.jopdesign.common.MethodInfo)3 AppInfoError (com.jopdesign.common.misc.AppInfoError)3