Class SLTypes

java.lang.Object
com.oracle.truffle.sl.nodes.SLTypes

public abstract class SLTypes extends Object
The type system of SL, as explained in SLLanguage. Based on the TypeSystem annotation, the Truffle DSL generates the subclass SLTypesGen with type test and type conversion methods for some types. In this class, we only cover types where the automatically generated ones would not be sufficient.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static SLNull
    Example of a manually specified type cast that replaces the automatically generated type cast that the Truffle DSL would generate.
    castBigNumber(long value)
    Informs the Truffle DSL that a primitive long value can be used in all specializations where a SLBigInteger is expected.
    static boolean
    Example of a manually specified type check that replaces the automatically generated type check that the Truffle DSL would generate.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SLTypes

      public SLTypes()
  • Method Details

    • isSLNull

      public static boolean isSLNull(Object value)
      Example of a manually specified type check that replaces the automatically generated type check that the Truffle DSL would generate. For SLNull, we do not need an instanceof check, because we know that there is only a singleton instance.
    • asSLNull

      public static SLNull asSLNull(Object value)
      Example of a manually specified type cast that replaces the automatically generated type cast that the Truffle DSL would generate. For SLNull, we do not need an actual cast, because we know that there is only a singleton instance.
    • castBigNumber

      public static SLBigInteger castBigNumber(long value)
      Informs the Truffle DSL that a primitive long value can be used in all specializations where a SLBigInteger is expected. This models the semantic of SL: It only has an arbitrary precision Number type (implemented as SLBigInteger, and long is only used as a performance optimization to avoid the costly SLBigInteger arithmetic for values that fit into a 64-bit primitive value.