Module Jkind.Sort
include Jkind_intf.Sort
with type t = Jkind_types.Sort.t
and type var = Jkind_types.Sort.var
and type univar = Jkind_types.Sort.univar
and type base = Jkind_types.Sort.base
and type Const.t = Jkind_types.Sort.Const.t
type t = Jkind_types.Sort.tA 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.
Rigid sort variables similiar to Tunivar for types. They can be specified to be equal by enter_repr but cannot be equated/unified.
enter_repr pairs f establishes correspondence between sort univars (for Trepr) using the given list of pairs, then calls f.
type base : immediate = Jkind_types.Sort.base = | Void(*No run time representation at all
*)| Scannable(*Standard ocaml value representation
*)| Untagged_immediate(*Untagged 31- or 63-bit immediates, but without the tag bit, so they must never be visible to the GC
*)| Float64(*Unboxed 64-bit floats
*)| Float32(*Unboxed 32-bit floats
*)| Word(*Unboxed native-size integers
*)| Bits8(*Unboxed 8-bit integers
*)| Bits16(*Unboxed 16-bit integers
*)| Bits32(*Unboxed 32-bit integers
*)| Bits64(*Unboxed 64-bit integers
*)| Vec128(*Unboxed 128-bit simd vectors
*)| Vec256(*Unboxed 256-bit simd vectors
*)| Vec512(*Unboxed 512-bit simd vectors
*)
These are the constant sorts -- fully determined and without variables
type var = Jkind_types.Sort.varA sort variable that can be unified during type-checking.
module Const : sig ... endmodule Var : sig ... endval void : tval scannable : tval float64 : tval float32 : tval word : tval bits32 : tval bits64 : tval new_var : level:int -> varCreate a new sort variable that can be unified.
This checks for equality, and sets any variables to make two sorts equal, if possible
val format : Format_doc.formatter -> t -> unitdefault_to_scannable_and_get extracts the sort as a `const`. If it's a variable, it is set to scannable first.
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.
Like default_to_scannable_and_get but operates directly on a var.
val undo_change : change -> unitval new_genvar : unit -> varCreate a fresh polymorphic sort variable (level = Ident.highest_scope).
val new_genvar_for_cmi : unit -> varCreate a polymorphic sort variable (level = Ident.highest_scope), intended for saving to a cmi.
val is_genvar : var -> boolReturns true iff the variable was created by new_genvar or new_genvar_for_cmi.
Get the concrete content of a variable. The returned sort must be representable (including rigid sorts).
subst s t applies the variable substitution s to t, replacing each Var v where (v, t') is in subst with t'.
Apply instantiation to every Var node in a sort. Generic variables (see is_genvar) are replaced by fresh vars registered via instance_with; non-generic variables are left unchanged. Must be called within the dynamic extent of instance_with.
val to_string_genvar : var -> stringReturns a human-readable name for a generic variable. Must be called within the dynamic extent of print_with_genvars.
val print_with_genvars : var list -> (string list -> 'a) -> 'aprint_with_genvars vars f assigns a fresh name to each var in vars, calls f with those names, and returns the result. Within the call to f, to_string_genvar will return the assigned name for each var.
val generalize_with : (unit -> 'a) -> 'a * var listgeneralize_with f runs f with sort generalization enabled (for let poly_ support). Returns the result of f and the list of sort variables lifted to generic during f.
val generalize : current_level:int -> t -> unitGeneralize sort variables when in sort generalization context. Sets the level of sort variables to Ident.highest_scope and accumulates them. This should be called from Ctype.generalize. Only has an effect when called within generalize_with.
module Debug_printers : sig ... endmodule Flat : sig ... end