Class ConditionProfile

java.lang.Object
com.oracle.truffle.api.nodes.NodeCloneable
com.oracle.truffle.api.utilities.ConditionProfile
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
BinaryConditionProfile, CountingConditionProfile

public abstract class ConditionProfile extends NodeCloneable
Abstract utility class to speculate on conditions. Condition profiles are intended to be used as part of if conditions. Example usage:
 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.
See Also:
  • Constructor Details

    • ConditionProfile

      public ConditionProfile()
  • Method Details