public final class GraalDirectives extends Object
Modifier and Type | Field and Description |
---|---|
static double |
FASTPATH_PROBABILITY |
static double |
LIKELY_PROBABILITY |
static double |
SLOWPATH_PROBABILITY |
static double |
UNLIKELY_PROBABILITY |
Constructor and Description |
---|
GraalDirectives() |
Modifier and Type | Method and Description |
---|---|
static void |
blackhole(boolean value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(byte value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(char value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(double value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(float value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(int value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(long value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(Object value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
blackhole(short value)
Consume a value, making sure the compiler doesn't optimize away the computation of this
value, even if it is otherwise unused.
|
static void |
controlFlowAnchor()
A call to this method will never be duplicated by control flow optimizations in the compiler.
|
static void |
deoptimize()
Directive for the compiler to fall back to the bytecode interpreter at this point.
|
static void |
deoptimizeAndInvalidate()
Directive for the compiler to fall back to the bytecode interpreter at this point, invalidate
the compiled code and reprofile the method.
|
static void |
ensureVirtualized(Object object)
Ensures that the given object will be virtual (escape analyzed) at all points that are
dominated by the current position.
|
static void |
ensureVirtualizedHere(Object object)
Ensures that the given object will be virtual at the current position.
|
static <T> T |
guardingNonNull(T value) |
static boolean |
inCompiledCode()
Returns a boolean value indicating whether the method is executed in Graal-compiled code.
|
static boolean |
injectBranchProbability(double probability,
boolean condition)
Injects a probability for the given condition into the profiling information of a branch
instruction.
|
static boolean |
injectIterationCount(double iterations,
boolean condition)
Injects an average iteration count of a loop into the probability information of a loop exit
condition.
|
static boolean |
opaque(boolean value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static byte |
opaque(byte value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static char |
opaque(char value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static double |
opaque(double value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static float |
opaque(float value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static int |
opaque(int value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static long |
opaque(long value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static short |
opaque(short value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
static <T> T |
opaque(T value)
Do nothing, but also make sure the compiler doesn't do any optimizations across this call.
|
public static final double LIKELY_PROBABILITY
public static final double UNLIKELY_PROBABILITY
public static final double SLOWPATH_PROBABILITY
public static final double FASTPATH_PROBABILITY
public GraalDirectives()
public static void deoptimize()
public static void deoptimizeAndInvalidate()
public static boolean inCompiledCode()
public static void controlFlowAnchor()
public static boolean injectBranchProbability(double probability, boolean condition)
if (injectBranchProbability(0.9, a > b)) {
// ...
}
There are predefined constants for commonly used probabilities (see
LIKELY_PROBABILITY
, UNLIKELY_PROBABILITY
, SLOWPATH_PROBABILITY
,
FASTPATH_PROBABILITY
).probability
- the probability value between 0.0 and 1.0 that should be injectedpublic static boolean injectIterationCount(double iterations, boolean condition)
for (int i = 0; injectIterationCount(500, i < array.length); i++) {
// ...
}
iterations
- the expected number of iterations that should be injectedpublic static void blackhole(boolean value)
public static void blackhole(byte value)
public static void blackhole(short value)
public static void blackhole(char value)
public static void blackhole(int value)
public static void blackhole(long value)
public static void blackhole(float value)
public static void blackhole(double value)
public static void blackhole(Object value)
public static boolean opaque(boolean value)
public static byte opaque(byte value)
public static short opaque(short value)
public static char opaque(char value)
public static int opaque(int value)
public static long opaque(long value)
public static float opaque(float value)
public static double opaque(double value)
public static <T> T opaque(T value)
public static <T> T guardingNonNull(T value)
public static void ensureVirtualized(Object object)
public static void ensureVirtualizedHere(Object object)