Class InlinedCountingConditionProfile

java.lang.Object
com.oracle.truffle.api.profiles.InlinedProfile
com.oracle.truffle.api.profiles.InlinedCountingConditionProfile

public final class InlinedCountingConditionProfile extends InlinedProfile
CountingConditionProfiles are useful to profile the outcome of conditions. A counting condition profile holds a count for each branch whether a branch was hit or not and communicates this to the compiler as frequency information. If binary information only is desired for each branch should use InlinedConditionProfile instead.

Usage example:

 abstract class AbsoluteNode extends Node {

     abstract void execute(int value);

     @Specialization
     int doDefault(int value,
                     @Cached InlinedCountingConditionProfile p) {
         if (p.profile(this, value >= 0)) {
             return value;
         } else {
             return -value;
         }
     }
 }
 
Since:
23.0
  • Method Details

    • profile

      public boolean profile(Node node, boolean value)
      Since:
      23.0
    • wasTrue

      public boolean wasTrue(Node node)
      Returns true if the profile(Node, boolean) method ever received a true value, otherwise false. For profiles with profiling disabled or uncached profiles this method always returns true.
      Since:
      23.0
    • wasFalse

      public boolean wasFalse(Node node)
      Returns true if the profile(Node, boolean) method ever received a false value, otherwise false. For profiles with profiling disabled or uncached profiles this method always returns true.
      Since:
      23.0
    • disable

      public void disable(Node node)
      Disables this profile by setting it to its generic state. After disabling it is guaranteed to never deoptimize 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 class InlinedProfile
      Since:
      23.0
    • reset

      public void reset(Node node)
      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 class InlinedProfile
      Since:
      23.0
    • toString

      public String toString(Node node)
      Prints a string representation of this inlined profile given a target node.
      Specified by:
      toString in class InlinedProfile
      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

      public static InlinedCountingConditionProfile getUncached()
      Returns the uncached version of the profile. The uncached version of a profile does not perform any profiling.
      Since:
      23.0