edu.uci.eecs.doc.clepsydra.cache
Class SingleMethodCacheStrategy
java.lang.Object
edu.uci.eecs.doc.clepsydra.cache.SingleMethodCacheStrategy
- All Implemented Interfaces:
- MethodCacheStrategy
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.
- Author:
- Trevor Harmon
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SingleMethodCacheStrategy
public SingleMethodCacheStrategy()
getInvokeHitRatio
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
- Parameters:
invokeInstruction
- a bytecode instruction that invokes a methodnode
- the node in the control flow tree in which the invoke instruction livesloopBoundStrategy
- 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
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
- Parameters:
returnStatement
- a control flow node representing a return statement
- Returns:
- true if the return to the caller is a cache hit; false otherwise
getIterations
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
- Throws:
UnknownLoopBoundException