Class ConditionProfile

  • All Implemented Interfaces:
    java.lang.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:
    createCountingProfile(), createBinaryProfile()