Enum NodeCost

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<NodeCost>

    public enum NodeCost
    extends java.lang.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.
    See Also:
    Node.getCost()
    • Enum Constant Detail

      • 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.
      • MONOMORPHIC

        public static final NodeCost MONOMORPHIC
        This node represents a specialized monomorphic version of an operation.
      • 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.
      • 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.
    • Method Detail

      • values

        public static NodeCost[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (NodeCost c : NodeCost.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static NodeCost valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • isTrivial

        public boolean isTrivial()