org.jikesrvm.compilers.opt.inlining
Class DefaultInlineOracle
java.lang.Object
org.jikesrvm.compilers.opt.inlining.InlineTools
org.jikesrvm.compilers.opt.inlining.DefaultInlineOracle
- All Implemented Interfaces:
- OptConstants, InlineOracle
public final class DefaultInlineOracle
- extends InlineTools
- implements InlineOracle
The default inlining oracle used by the optimizing compiler.
The basic strategy is as follows:
- Always inline trivial methods that can be inlined without a guard
- At O1 and greater use a mix of profile information and static heuristics
to inline larger methods and methods that require guards.
Fields inherited from interface org.jikesrvm.compilers.opt.driver.OptConstants |
EPILOGUE_BCI, EPILOGUE_BLOCK_BCI, EXTANT_ANALYSIS_BCI, INSTRUMENTATION_BCI, MAYBE, METHOD_COUNTER_BCI, NO, OSR_PROLOGUE, PROLOGUE_BCI, PROLOGUE_BLOCK_BCI, RECTIFY_BCI, RUNTIME_SERVICES_BCI, SSA_SYNTH_BCI, SYNCHRONIZED_MONITORENTER_BCI, SYNCHRONIZED_MONITOREXIT_BCI, SYNTH_CATCH_BCI, SYNTH_LOOP_VERSIONING_BCI, UNKNOWN_BCI, YES |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultInlineOracle
public DefaultInlineOracle()
shouldInline
public InlineDecision shouldInline(CompilationState state)
- Description copied from interface:
InlineOracle
- Should we inline a particular call site?
- Specified by:
shouldInline
in interface InlineOracle
- Parameters:
state
- information needed to make the inlining decision
- Returns:
- an InlineDecision with the result
chooseGuard
private byte chooseGuard(RVMMethod caller,
RVMMethod singleImpl,
RVMMethod callee,
CompilationState state,
boolean codePatchSupported)
- Logic to select the appropriate guarding mechanism for the edge
from caller to callee according to the controlling
OptOptions
.
If we are using IG_CODE_PATCH, then this method also records
the required dependency.
Precondition: lock on RVMClass.classLoadListener
is held.
- Parameters:
caller
- The caller methodcallee
- The callee methodcodePatchSupported
- Can we use code patching at this call site?
inliningActionCost
private int inliningActionCost(int inlinedBodyEstimate,
boolean needsGuard,
boolean preEx,
OptOptions opts)
- Estimate the expected cost of the inlining action
(includes both the inline body and the guard/off-branch code).
- Parameters:
inlinedBodyEstimate
- size estimate for inlined bodyneedsGuard
- is it going to be a guarded inline?preEx
- can preEx inlining be used to avoid the guard?opts
- controlling options object
- Returns:
- the estimated cost of the inlining action