public abstract class InlineTools extends Object
Constructor and Description |
---|
InlineTools() |
Modifier and Type | Method and Description |
---|---|
static boolean |
hasBody(RVMMethod callee)
Does the callee method have a body?
|
static boolean |
hasInlinePragma(RVMMethod callee,
CompilationState state)
Should the callee method always be inlined?
|
static boolean |
hasNoInlinePragma(RVMMethod callee,
CompilationState state)
Should the callee method be barred from ever being considered for inlining?
|
static boolean |
implementsInterface(Class<?> A,
Class<?> B) |
static int |
inlinedSizeEstimate(NormalMethod callee,
CompilationState state)
Given the currently available information at the call site,
what's our best guess on the inlined size of the callee?
|
static boolean |
isCurrentlyFinal(RVMMethod callee,
boolean searchSubclasses)
Is the method CURRENTLY final (not overridden by any subclass)?
|
static boolean |
isForbiddenSpeculation(RVMMethod caller,
RVMMethod callee)
Is it safe to speculatively inline the callee into the caller?
|
static boolean |
needsGuard(RVMMethod callee)
Does an inlined call to callee need a guard, to protect against
a mispredicted dynamic dispatch?
|
public InlineTools()
public static boolean implementsInterface(Class<?> A, Class<?> B)
A
- a classB
- an interfaceA
directly implement the interface B
?public static boolean hasBody(RVMMethod callee)
callee
- The callee methodtrue
if it has bytecodes, false otherwise.public static boolean needsGuard(RVMMethod callee)
callee
- the callee methodpublic static boolean isCurrentlyFinal(RVMMethod callee, boolean searchSubclasses)
Note that this says nothing about whether or not the method will be overridden by future dynamically loaded classes.
callee
- the method to checksearchSubclasses
- whether so search subclasses.public static int inlinedSizeEstimate(NormalMethod callee, CompilationState state)
callee
- the method to be inlinedstate
- the compilation state decribing the call site where it
is to be inlinedpublic static boolean hasInlinePragma(RVMMethod callee, CompilationState state)
callee
- the method being considered for inliningstate
- the compilation state of the caller.public static boolean hasNoInlinePragma(RVMMethod callee, CompilationState state)
callee
- the method being considered for inliningstate
- the compilation state of the caller.public static boolean isForbiddenSpeculation(RVMMethod caller, RVMMethod callee)
Some forms of speculative inlining are unsafe to apply to methods of the core virtual machine because if we are forced to invalidate the methods, we will be unable to compile their replacement method.
TODO The current test is overly conservative, but past attempts at defining a more precise set of "third rail" classes have always resulted in missing some (only to discover them later when Jikes RVM hangs or crashes.)
caller
- the caller methodcallee
- the callee method