Class SingleMethodCacheStrategy

  extended by edu.uci.eecs.doc.clepsydra.cache.SingleMethodCacheStrategy
All Implemented Interfaces:

public class SingleMethodCacheStrategy
extends Object

Performs cache hit analysis based on a single-method cache configuration. The analysis is based on WCET Analysis for a Java Processor by Martin Schoeberl and Rasmus Pedersen.

Trevor Harmon

Nested Class Summary
Nested classes/interfaces inherited from interface edu.uci.eecs.doc.clepsydra.cache.MethodCacheStrategy
Constructor Summary
Method Summary
 MethodCacheStrategy.HitRatio getInvokeHitRatio(InvokeInstruction invokeInstruction, Node node, LoopBoundStrategy loopBoundStrategy)
          Returns the cache hit ratio for the given invoke instruction.
protected  int getIterations(Node node, LoopBoundStrategy loopBoundStrategy)
          Returns the number of times the node is executed.
 boolean isReturnHit(ReturnStatement returnStatement)
          Returns true if the given return statement is guaranteed to result in a method cache hit.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public SingleMethodCacheStrategy()
Method Detail


public MethodCacheStrategy.HitRatio getInvokeHitRatio(InvokeInstruction invokeInstruction,
                                                      Node node,
                                                      LoopBoundStrategy loopBoundStrategy)
Returns the cache hit ratio for the given invoke instruction. For example, if the method is only invoked once by the given block, and it is guaranteed to be in the cache, then the hit ratio would be 1/1. If the method is invoked in a loop that executes 10 times, and the first iteration is a miss and all others are hits, then the hit ratio would be 9/10. For a single method cache, the hit ratio will always be 0.

Specified by:
getInvokeHitRatio in interface MethodCacheStrategy
invokeInstruction - a bytecode instruction that invokes a method
node - the node in the control flow tree in which the invoke instruction lives
loopBoundStrategy - if the invocation occurs in a loop, this algorithm is used to determine the maximum number of iterations of the loop
a hit ratio object


public boolean isReturnHit(ReturnStatement returnStatement)
Returns true if the given return statement is guaranteed to result in a method cache hit. (For a single method cache, this is never true.)

Specified by:
isReturnHit in interface MethodCacheStrategy
returnStatement - a control flow node representing a return statement
true if the return to the caller is a cache hit; false otherwise


protected int getIterations(Node node,
                            LoopBoundStrategy loopBoundStrategy)
                     throws UnknownLoopBoundException
Returns the number of times the node is executed. Examples: Without loops, iterations = 1 In a single loop of bound 10, iterations = 10 In a nested loop with inner bound 10 and outer bound 10, iterations = 100