Class HostCompilerDirectives
java.lang.Object
com.oracle.truffle.api.HostCompilerDirectives
Directives that influence the optimizations of the host compiler. These operations affect how the
Truffle interpreter is itself compiled.
- Since:
- 21.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interface
Marks a method that is an implementation of a Truffle interpreter, and which should receive additional optimization budget.static @interface
Deprecated.use is no longer needed.static @interface
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. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Indicates whether a branch is executed only in the interpreter.
-
Method Details
-
inInterpreterFastPath
public static boolean inInterpreterFastPath()Indicates whether a branch is executed only in the interpreter. In addition toCompilerDirectives.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 eitherCompilerDirectives.transferToInterpreterAndInvalidate()
orCompilerDirectives.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.- Returns:
true
if executed in the interpreter,false
in compiled code.- Since:
- 23.0
-