public abstract class ConditionProfile extends NodeCloneable
private final ConditionProfile zero = ConditionProfile.createBinaryProfile();
int value = ...;
if (zero.profile(value == 0)) {
return 0;
} else {
return value;
}
All instances of ConditionProfile (and subclasses) must be held in final fields
for compiler optimizations to take effect.createCountingProfile(),
createBinaryProfile()| Constructor and Description |
|---|
ConditionProfile() |
| Modifier and Type | Method and Description |
|---|---|
static ConditionProfile |
createBinaryProfile()
Returns a
ConditionProfile that speculates on conditions to be never true or to be
never false. |
static ConditionProfile |
createCountingProfile()
|
abstract boolean |
profile(boolean value) |
clonepublic abstract boolean profile(boolean value)
public static ConditionProfile createCountingProfile()
ConditionProfile that speculates on conditions to be never
true or to be never false. Additionally to a binary profile this
method returns a condition profile that also counts the number of times the condition was
true and false. This information is reported to the underlying optimization system using
CompilerDirectives.injectBranchProbability(double, boolean). Condition profiles are
intended to be used as part of if conditions.ConditionProfile,
createBinaryProfile()public static ConditionProfile createBinaryProfile()
ConditionProfile that speculates on conditions to be never true or to be
never false. Condition profiles are intended to be used as part of if conditions.ConditionProfile,
createCountingProfile()