Module Jkind.Sort

include Jkind_intf.Sort with type t = Jkind_types.Sort.t and type base = Jkind_types.Sort.base and type Const.t = Jkind_types.Sort.Const.t

A sort classifies how a type is represented at runtime. Every concrete jkind has a sort, and knowing the sort is sufficient for knowing the calling convention of values of a given type.

type base = Jkind_types.Sort.base =
  1. | Void
    (*

    No run time representation at all

    *)
  2. | Value
    (*

    Standard ocaml value representation

    *)
  3. | Untagged_immediate
    (*

    Untagged 31- or 63-bit immediates, but without the tag bit, so they must never be visible to the GC

    *)
  4. | Float64
    (*

    Unboxed 64-bit floats

    *)
  5. | Float32
    (*

    Unboxed 32-bit floats

    *)
  6. | Word
    (*

    Unboxed native-size integers

    *)
  7. | Bits8
    (*

    Unboxed 8-bit integers

    *)
  8. | Bits16
    (*

    Unboxed 16-bit integers

    *)
  9. | Bits32
    (*

    Unboxed 32-bit integers

    *)
  10. | Bits64
    (*

    Unboxed 64-bit integers

    *)
  11. | Vec128
    (*

    Unboxed 128-bit simd vectors

    *)
  12. | Vec256
    (*

    Unboxed 256-bit simd vectors

    *)
  13. | Vec512
    (*

    Unboxed 512-bit simd vectors

    *)

These are the constant sorts -- fully determined and without variables

type var

A sort variable that can be unified during type-checking.

module Const : sig ... end
module Var : sig ... end
val void : t
val value : t
val float64 : t
val float32 : t
val word : t
val bits32 : t
val bits64 : t
val new_var : level:int -> t

Create a new sort variable that can be unified.

val of_base : base -> t
val of_const : Const.t -> t
val of_var : var -> t
val equate : t -> t -> bool

This checks for equality, and sets any variables to make two sorts equal, if possible

val format : Format.formatter -> t -> unit
val is_void_defaulting : t -> bool

Checks whether this sort is void, defaulting to value if a sort variable is unfilled.

val default_to_value_and_get : t -> Const.t

default_to_value_and_get extracts the sort as a `const`. If it's a variable, it is set to value first.

val default_for_transl_and_get : t -> Const.t

default_for_transl_and_get extracts the sort as a `const`. If it's a variable, it is set to value first. After we have support for void, this will default to void instead.

type change

To record changes to sorts, for use with `Types.snapshot, backtrack`

val undo_change : change -> unit
module Debug_printers : sig ... end
module Flat : sig ... end