Class ValueProfile

java.lang.Object
com.oracle.truffle.api.utilities.ValueProfile
Direct Known Subclasses:
ExactClassValueProfile, IdentityValueProfile, PrimitiveValueProfile

public abstract class ValueProfile extends Object
Utility class to speculate on certain properties of values. Example usage:
 private final ValueProfile classProfile = ValueProfile.createClassProfile();
 
 return classProfile.profile(value);
 
All instances of ValueProfile (and subclasses) must be held in final fields for compiler optimizations to take effect.
See Also:
  • Constructor Details

    • ValueProfile

      public ValueProfile()
  • Method Details

    • profile

      public abstract <T> T profile(T value)
    • createPrimitiveProfile

      public static PrimitiveValueProfile createPrimitiveProfile()
      Returns a PrimitiveValueProfile that speculates on the primitive equality or object identity of a value.
    • createClassProfile

      public static ValueProfile createClassProfile()
      Returns a ValueProfile that speculates on the exact class of a value.
    • createIdentityProfile

      public static ValueProfile createIdentityProfile()
      Returns a ValueProfile that speculates on the object identity of a value.