Package com.oracle.truffle.api.profiles
Class InlinedBranchProfile
java.lang.Object
com.oracle.truffle.api.profiles.InlinedProfile
com.oracle.truffle.api.profiles.InlinedBranchProfile
BranchProfiles are profiles to speculate on branches that are unlikely to be visited. If the
enter(Node)
method is invoked first the optimized code is invalidated and the branch
where enter(Node)
is invoked is enabled for compilation. Otherwise if the
enter(Node)
method was never invoked the branch will not get compiled.
Usage example:
class ExampleNode extends Node { abstract int execute(int value); @Specialization int doDefault(int value, @Cached InlinedBranchProfile errorProfile) { if (value == Integer.MAX_VALUE) { errorProfile.enter(this); throw new Error("Invalid input value"); } return value; } }
- Since:
- 23.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Disables this profile by setting it to its generic state.void
static InlinedBranchProfile
Returns the uncached version of the profile.static InlinedBranchProfile
inline
(InlineSupport.InlineTarget target) Returns an inlined version of the profile.void
Resets this profile to its uninitialized state.Prints a string representation of this inlined profile given a target node.boolean
wasEntered
(Node node) Methods inherited from class com.oracle.truffle.api.profiles.InlinedProfile
toString
-
Method Details
-
enter
- Since:
- 23.0
-
wasEntered
Returnstrue
if theenter(Node)
method was ever called, otherwisefalse
. For profiles with profiling disabled oruncached
profiles this method always returnstrue
.- Since:
- 23.0
-
reset
Resets this profile to its uninitialized state. Has no effect if this profile is already in its uninitialized state or a disabled version of this profile is used.This method must not be called on compiled code paths. Note that disabling the profile will not invalidate existing compiled code that uses this profile.
- Specified by:
reset
in classInlinedProfile
- Since:
- 23.0
-
disable
Disables this profile by setting it to its generic state. After disabling it is guaranteed to neverdeoptimize
on any invocation of a profile method.This method must not be called on compiled code paths. Note that disabling the profile will not invalidate existing compiled code that uses this profile.
- Specified by:
disable
in classInlinedProfile
- Since:
- 23.0
-
toString
Prints a string representation of this inlined profile given a target node.- Specified by:
toString
in classInlinedProfile
- Since:
- 23.0
-
inline
Returns an inlined version of the profile. This version is automatically used by Truffle DSL node inlining.- Since:
- 23.0
-
getUncached
Returns the uncached version of the profile. The uncached version of a profile does not perform any profiling.- Since:
- 23.0
-