public final class HostCompilerDirectives extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
HostCompilerDirectives.BytecodeInterpreterSwitch
Marks a method that is an implementation of a Truffle interpreter, and which should receive
additional optimization budget.
|
static interface |
HostCompilerDirectives.InliningCutoff
Hints to Truffle host inlining that a particular method is partial evaluatable, but it would
be a good place for a cutoff when performing host inlining.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
inInterpreterFastPath()
Indicates whether a branch is executed only in the interpreter.
|
public static boolean inInterpreterFastPath()
CompilerDirectives.inInterpreter()
, this method instructs the host compiler to treat
the positive branch as frequently executed code of high importance. Branches protected by
this method should be treated as if they were runtime compiled code paths, even if they may
never actually be compiled. This means that slow-paths must be protected using either
CompilerDirectives.transferToInterpreterAndInvalidate()
or CompilerDirectives.TruffleBoundary
.
A common use case for this directive is in counting condition profiles, where counters must
be protected by CompilerDirectives.inInterpreter()
but also need to be optimized as
fast-path by the host compiler. Without this directive, the host compiler may treat the
branch as a slow-path branch.
true
if executed in the interpreter, false
in compiled code.