edu.uci.eecs.doc.clepsydra.cache
Interface MethodCacheStrategy

All Known Implementing Classes:
DualMethodCacheStrategy, SingleMethodCacheStrategy

public interface MethodCacheStrategy

A common interface for various method cache analysis strategies. By abstracting strategies behind this interface, Clepsydra can use a variety of method cache strategies without knowing the details of how they work.

Author:
Trevor Harmon

Nested Class Summary
static class MethodCacheStrategy.HitRatio
          A simple encapsulation of a cache hit ratio.
 
Method Summary
 MethodCacheStrategy.HitRatio getInvokeHitRatio(InvokeInstruction invokeInstruction, Node node, LoopBoundStrategy loopBoundStrategy)
          Returns the cache hit ratio for the given invoke instruction.
 boolean isReturnHit(ReturnStatement returnStatement)
          Returns true if the given return statement is guaranteed to result in a method cache hit.
 

Method Detail

getInvokeHitRatio

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.

Parameters:
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
Returns:
a hit ratio object

isReturnHit

boolean isReturnHit(ReturnStatement returnStatement)
Returns true if the given return statement is guaranteed to result in a method cache hit.

Parameters:
returnStatement - a control flow node representing a return statement
Returns:
true if the return to the caller is a cache hit; false otherwise