Enum Class NodeCost

java.lang.Object
java.lang.Enum<NodeCost>
com.oracle.truffle.api.nodes.NodeCost
All Implemented Interfaces:
Serializable, Comparable<NodeCost>, Constable

public enum NodeCost extends Enum<NodeCost>
Represents a rough estimate for the cost of a Node. This estimate can be used by runtime systems or guest languages to implement heuristics based on Truffle ASTs.
Since:
0.8 or earlier
See Also:
  • Enum Constant Details

    • NONE

      public static final NodeCost NONE
      This node has literally no costs and should be ignored for heuristics. This is particularly useful for wrapper and profiling nodes which should not influence the heuristics.
      Since:
      0.8 or earlier
    • UNINITIALIZED

      public static final NodeCost UNINITIALIZED
      Since:
      0.8 or earlier
    • MONOMORPHIC

      public static final NodeCost MONOMORPHIC
      This node represents a specialized monomorphic version of an operation.
      Since:
      0.8 or earlier
    • POLYMORPHIC

      public static final NodeCost POLYMORPHIC
      This node represents a polymorphic version of an operation. For multiple chained polymorphic nodes the first may return MONOMORPHIC and all additional nodes should return POLYMORPHIC.
      Since:
      0.8 or earlier
    • MEGAMORPHIC

      public static final NodeCost MEGAMORPHIC
      This node represents a megamorphic version of an operation. This value should only be used if the operation implementation supports monomorphism and polymorphism otherwise MONOMORPHIC should be used instead.
      Since:
      0.8 or earlier
  • Method Details

    • values

      public static NodeCost[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static NodeCost valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • isTrivial

      public boolean isTrivial()
      Since:
      0.8 or earlier
    • fromCount

      public static NodeCost fromCount(int nodeCount)
      Finds the node cost for an associated node count. Returns UNINITIALIZED for 0, MONOMORPHIC for 1 and POLYMORPHIC for any other value.
      Since:
      19.0