jon.recoil.org

Module Cmm_helpers

module Unboxed_or_untagged_array_tags : sig ... end

Tags for unboxed or untagged arrays using mixed block headers with scannable_prefix = 0

val arch_bits : int
val log2_size_addr : int
type arity = {
  1. function_kind : Lambda.function_kind;
  2. params_layout : Lambda.layout list;
  3. return_layout : Lambda.layout;
}

bind name arg fn is equivalent to let name = arg in fn name, or simply fn arg if arg is simple enough

Headers

val floatarray_tag : Debuginfo.t -> Cmm.expression

A constant equal to the tag for float arrays

val block_header : int -> int -> nativeint

block_header tag size creates a header with tag tag for a block of size size

val black_block_header : int -> int -> nativeint

Same as block_header, but with GC bits set to black

val black_mixed_block_header : int -> int -> scannable_prefix_len:int -> nativeint

Same as black_block_header, but for a mixed block

val black_closure_header : int -> nativeint
val infix_header : int -> nativeint

Infix header at the given offset

val black_custom_header : size:int -> nativeint
val pack_closure_info : arity:int -> startenv:int -> is_last:bool -> nativeint
val closure_info : arity:Cmm_helpers.arity -> startenv:int -> is_last:bool -> nativeint

Closure info for a closure of given arity and distance to environment

val closure_info' : arity:(Lambda.function_kind * 'a list) -> startenv:int -> is_last:bool -> nativeint
val alloc_infix_header : int -> Debuginfo.t -> Cmm.expression

Wrappers

val int_const : Debuginfo.t -> int -> Cmm.expression

Make an integer constant from the given integer (tags the integer)

Arithmetical operations on integers

val add_int_ptr : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

Similar to add_int but produces a result with machtype Addr iff ptr_out_of_heap is false.

Integer tagging. tag_int x = (x lsl 1) + 1

Integer untagging. untag_int x = (x asr 1)

val div_int : ?dividend_cannot_be_min_int:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

signed division of two register-width integers

val mod_int : ?dividend_cannot_be_min_int:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

signed remainder of two register-width integers

Boolean negation

Integer and float comparison that returns int not bool. The untagged versions do not tag the result and do not optimise known-constant cases.

val mk_compare_floats : Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression
val mk_compare_ints_untagged : Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression
val mk_unsigned_compare_ints_untagged : Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression
val mk_compare_floats_untagged : Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression
val mk_compare_float32s_untagged : Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression

Convert a tagged integer into a raw integer with boolean meaning

val float_of_float16 : Debuginfo.t -> Cmm.expression -> Cmm.expression

Conversions for 16-bit floats

val float16_of_float : Debuginfo.t -> Cmm.expression -> Cmm.expression

Float boxing and unboxing

val unbox_float32 : Debuginfo.t -> Cmm.expression -> Cmm.expression
val unbox_float : Debuginfo.t -> Cmm.expression -> Cmm.expression

Vector boxing and unboxing

val unbox_vec128 : Debuginfo.t -> Cmm.expression -> Cmm.expression
val unbox_vec256 : Debuginfo.t -> Cmm.expression -> Cmm.expression
val unbox_vec512 : Debuginfo.t -> Cmm.expression -> Cmm.expression
val return_unit : Debuginfo.t -> Cmm.expression -> Cmm.expression

Make the given expression return a unit value

Blocks

val mk_load_mut : Cmm.memory_chunk -> Cmm.operation

Non-atomic load of a mutable field

val strided_field_address : Cmm.expression -> index:int -> stride:int -> Debuginfo.t -> Cmm.expression

strided_field_address ptr ~index ~stride dbg returns an expression for the address of the indexth field of the block pointed to by ptr. The field width is determined by stride.

val field_address : ?memory_chunk:Cmm.memory_chunk -> Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

field_address ptr n dbg returns an expression for the address of the nth field of the block pointed to by ptr. memory_chunk is only used for computation of the field width; it defaults to a memory chunk matching the machine width.

get_field_gen mut ptr n dbg returns an expression for the access to the nth field of the block pointed to by ptr. The memory_chunk used is always Word_val.

val get_field_gen_given_memory_chunk : Cmm.memory_chunk -> Asttypes.mutable_flag -> Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

Like get_field_gen but allows use of a different memory_chunk.

Get the field of the given block whose index is specified by the Cmm expresson index (in words).

val field_address_computed : Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

field_address_computed ptr ofs dbg returns an expression for the address at offset ofs (in machine words) of the block pointed to by ptr. The resulting expression is a derived pointer of type Addr.

Load a block's header

Load a block's tag

Arrays

val wordsize_shift : int
val numfloat_shift : int

Array loads and stores

unboxed_float_array_ref and float_array_ref differ in the boxing of the result; float_array_set takes an unboxed float

val unboxed_float_array_ref : Asttypes.mutable_flag -> block:Cmm.expression -> index:Cmm.expression -> Debuginfo.t -> Cmm.expression

Strings

val string_length : Cmm.expression -> Debuginfo.t -> Cmm.expression
val bigstring_get_alignment : Cmm.expression -> Cmm.expression -> int -> Debuginfo.t -> Cmm.expression
module Extended_machtype_component : sig ... end
module Extended_machtype : sig ... end

Allocations

val make_alloc : mode:Cmm.Alloc_mode.t -> Debuginfo.t -> tag:int -> Cmm.expression list -> Cmm.expression

Allocate a block of regular values with the given tag

val make_float_alloc : mode:Cmm.Alloc_mode.t -> Debuginfo.t -> tag:int -> Cmm.expression list -> Cmm.expression

Allocate a block of unboxed floats with the given tag

val make_closure_alloc : mode:Cmm.Alloc_mode.t -> Debuginfo.t -> tag:int -> Cmm.expression list -> Cmm.memory_chunk list -> Cmm.expression

Allocate a closure block, to hold a set of closures.

This takes a list of expressions exprs and a list of memory_chunks that correspond pairwise. Both lists must be the same length.

The list of expressions includes _all_ fields of the closure block, including the code pointers and closure information fields.

val make_mixed_alloc : mode:Cmm.Alloc_mode.t -> Debuginfo.t -> tag:int -> value_prefix_size:int -> Cmm.expression list -> Cmm.memory_chunk list -> Cmm.expression

Allocate an mixed block of the corresponding tag and scannable prefix size. The memory_chunk list should give the memory_chunk corresponding to each element from the expression list.

Sys.opaque_identity

Generic application functions

val machtype_identifier : Cmm.machtype -> string

Get an identifier for a given machtype, used in the name of the generic functions.

val curry_function_sym : Lambda.function_kind -> Cmm.machtype list -> Cmm.machtype -> Cmm.symbol

Get the symbol for the generic currying or tuplifying wrapper with n arguments, and ensure its presence in the set of defined symbols.

val fail_if_called_indirectly_sym : Cmm.symbol

Bigarrays

val bigarray_elt_size_in_bytes : Lambda.bigarray_kind -> int

Returns the size (in number of bytes) of a single element contained in a bigarray.

val bigarray_word_kind : Lambda.bigarray_kind -> Cmm.memory_chunk

Returns the memory chunk corresponding to the kind of elements stored in a bigarray.

Operations on n-bit integers

val ignore_low_bit_int : Cmm.expression -> Cmm.expression

Simplify the given expression knowing the low bit of the argument will be irrelevant

val low_bits : bits:int -> dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

Simplify the given expression knowing that bits other than the low bits bits will be irrelevant

val sign_extend : bits:int -> dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

sign-extend a given integer expression from bits bits to an entire register

val zero_extend : bits:int -> dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

zero-extend a given integer expression from bits bits to an entire register

Box a given integer, without sharing of constants

Unbox a given boxed integer

Used to prepare 32-bit integers on 64-bit platforms for a lsr operation

val unaligned_load_16 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_set_16 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_load_32 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_set_32 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_load_f32 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_set_f32 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_load_64 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_set_64 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_load_128 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_set_128 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val aligned_load_128 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val aligned_set_128 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_load_256 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_set_256 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val aligned_load_256 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val aligned_set_256 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_load_512 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val unaligned_set_512 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val aligned_load_512 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression
val aligned_set_512 : ptr_out_of_heap:bool -> Cmm.expression -> Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

Primitives

type unary_primitive = Cmm.expression -> Debuginfo.t -> Cmm.expression
val int_as_pointer : Cmm_helpers.unary_primitive

Int_as_pointer primitive

val raise_prim : Lambda.raise_kind -> extra_args:Cmm.expression list -> Cmm_helpers.unary_primitive

Raise primitive

Unary negation of an OCaml integer

val addr_array_length : Cmm_helpers.unary_primitive

Return the length of the array argument, as an OCaml integer

Byte swap primitive Operates on Cmm integers (unboxed values)

type binary_primitive = Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

setfield offset value_is_ptr init ptr value dbg

val add_int_caml : Cmm_helpers.binary_primitive

Operations on OCaml integers

val sub_int_caml : Cmm_helpers.binary_primitive
val mul_int_caml : Cmm_helpers.binary_primitive
val div_int_caml : Cmm_helpers.binary_primitive
val mod_int_caml : Cmm_helpers.binary_primitive
val and_int_caml : Cmm_helpers.binary_primitive
val xor_int_caml : Cmm_helpers.binary_primitive

Same as setfield, except the offset is one of the arguments. Args: pointer (structure/array/...), index, value

val transl_switch_clambda : Debuginfo.t -> Cmm.expression -> int array -> Cmm.expression array -> Cmm.expression

transl_switch_clambda loc kind arg index cases

Method call : send kind met obj args dbg

  • met is a method identifier, which can be a hashed variant or an index in obj's method table, depending on kind
  • obj is the object whose method is being called
  • args is the extra arguments to the method call (Note: I'm not aware of any way for the frontend to generate any arguments other than the cache and cache position)
val entry_point : Compilation_unit.t list -> Cmm.phrase list

Entry point

val global_table : Compilation_unit.t list -> Cmm.phrase

Generate the caml_globals table

val reference_symbols : Cmm.symbol list -> Cmm.phrase

Add references to the given symbols

val globals_map : (Compilation_unit.t * Stdlib.Digest.t option * Stdlib.Digest.t option * Symbol.t list) list -> Cmm.phrase

Generate the caml_globals_map structure, as a marshalled string constant. The runtime representation of the type here must match that of type global_map in the natdynlink code.

val frame_table : Compilation_unit.t list -> Cmm.phrase

Generate the caml_frametable table, referencing the frametables from the given compilation units

val data_segment_table : Compilation_unit.t list -> Cmm.phrase

Generate the tables for data and code positions respectively of the given compilation units

val code_segment_table : Compilation_unit.t list -> Cmm.phrase
val predef_exception : int -> string -> Cmm.phrase

Generate data for a predefined exception

val plugin_header : Cmxs_format.dynunit list -> Cmm.phrase

Emit constant symbols

val cdefine_symbol : Cmm.symbol -> Cmm.data_item list

Produce the data_item list corresponding to a symbol definition

val emit_block : Cmm.symbol -> nativeint -> Cmm.data_item list -> Cmm.data_item list

emit_block symb white_header cont prepends to cont the header and symbol for the block. cont must already contain the fields of the block (and may contain additional data items afterwards).

val emit_float32_constant : Cmm.symbol -> float -> Cmm.data_item list -> Cmm.data_item list

Emit specific kinds of constant blocks as data items

val emit_float_constant : Cmm.symbol -> float -> Cmm.data_item list -> Cmm.data_item list
val emit_string_constant : Cmm.symbol -> string -> Cmm.data_item list -> Cmm.data_item list
val emit_int32_constant : Cmm.symbol -> int32 -> Cmm.data_item list -> Cmm.data_item list
val emit_int64_constant : Cmm.symbol -> int64 -> Cmm.data_item list -> Cmm.data_item list
val emit_nativeint_constant : Cmm.symbol -> nativeint -> Cmm.data_item list -> Cmm.data_item list
val emit_vec128_constant : Cmm.symbol -> Cmm.vec128_bits -> Cmm.data_item list -> Cmm.data_item list
val emit_vec256_constant : Cmm.symbol -> Cmm.vec256_bits -> Cmm.data_item list -> Cmm.data_item list
val emit_vec512_constant : Cmm.symbol -> Cmm.vec512_bits -> Cmm.data_item list -> Cmm.data_item list
val emit_float_array_constant : Cmm.symbol -> float list -> Cmm.data_item list -> Cmm.data_item list

Helper functions and values used by Flambda 2.

val void : Cmm.expression

The void (i.e. empty tuple) cmm value. Not to be confused with () : unit.

val unit : dbg:Debuginfo.t -> Cmm.expression

Create the single unit value.

Create an expression from a variable.

val symbol : dbg:Debuginfo.t -> Cmm.symbol -> Cmm.expression

Create an expression that gives the value of an object file symbol.

val float : dbg:Debuginfo.t -> float -> Cmm.expression

Create a constant float expression.

val float32 : dbg:Debuginfo.t -> float -> Cmm.expression

Create a constant float32 expression.

val int : dbg:Debuginfo.t -> int -> Cmm.expression

Create a constant int expression.

val int32 : dbg:Debuginfo.t -> int32 -> Cmm.expression

Create a constant int expression from an int32.

val int64 : dbg:Debuginfo.t -> int64 -> Cmm.expression

Create a constant int expression from an int64.

Create a constant vec128 expression from two int64s.

Create a constant vec256 expression from four int64s.

Create a constant vec512 expression from eight int64s.

Create a constant int expression from a nativeint.

Create a Clet, except if the body just returns the bound variable, in which case the Clet is elided.

Create a sequence of expressions. Will erase void expressions as needed.

val ite : dbg:Debuginfo.t -> then_dbg:Debuginfo.t -> then_:Cmm.expression -> else_dbg:Debuginfo.t -> else_:Cmm.expression -> Cmm.expression -> Cmm.expression

Creates a conditional branching on the given condition.

val trywith : dbg:Debuginfo.t -> body:Cmm.expression -> exn_var:Backend_var.With_provenance.t -> extra_args:(Backend_var.With_provenance.t * Cmm.machtype) list -> handler_cont:Cmm.trywith_shared_label -> handler:Cmm.expression -> unit -> Cmm.expression

Create a try-with structure. The exn_var is the variable bound to the caught exception in the handler.

Static jumps

handler id vars body is_cold creates a static handler for exit number id, binding variables vars in body.

cexit id args creates the cmm expression for static to a static handler with exit number id, with arguments args.

val trap_return : Cmm.expression -> Cmm.trap_action list -> Cmm.expression

trap_return res traps creates the cmm expression for returning res after applying the trap actions in traps.

val create_ccatch : rec_flag:bool -> handlers:Cmm.static_handler list -> body:Cmm.expression -> Cmm.expression

Enclose a body with some static handlers.

Shift operations. Inputs: a tagged caml integer and an untagged machine integer. Outputs: a tagged caml integer. Takes as first argument a tagged caml integer, and as second argument an untagged machine intger which is the amount to shift the first argument by.

val lsl_int_caml_raw : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression
val lsr_int_caml_raw : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression
val asr_int_caml_raw : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression -> Cmm.expression

Reinterpret cast functions

val int64_as_float : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val float_as_int64 : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

Conversions functions between integers and floats.

val int_of_float : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val float_of_int : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val int_of_float32 : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val float32_of_int : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val float32_of_float : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val float_of_float32 : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

Integer arithmetic (dis)equality of cmm expressions. Returns an untagged integer (either 0 or 1) to represent the result of the comparison.

Integer arithmetic signed comparisons on cmm expressions. Returns an untagged integer (either 0 or 1) to represent the result of the comparison.

Integer arithmetic unsigned comparisons on cmm expressions. Returns an untagged integer (either 0 or 1) to represent the result of the comparison.

val float_abs : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

Asbolute value on floats.

val float32_abs : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val float_neg : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

Arithmetic negation on floats.

val float32_neg : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression

Float arithmetic operations.

Float arithmetic (dis)equality of cmm expressions. Returns an untagged integer (either 0 or 1) to represent the result of the comparison.

Float arithmetic comparisons on cmm expressions. Returns an untagged integer (either 0 or 1) to represent the result of the comparison.

val beginregion : dbg:Debuginfo.t -> Cmm.expression
val endregion : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val probe : dbg:Debuginfo.t -> name:string -> handler_code_linkage_name:string -> enabled_at_init:bool -> args:Cmm.expression list -> Cmm.expression

direct_call ty f_code args creates a direct call to the function code f_code with arguments args, with a return value of type ty.

If a closure needs to be passed, it must be included in args.

Same as direct_call but for an indirect call.

Same as direct_call but for an indirect call that is know to be a full application (since this enables a few optimisations).

val bigarray_load : dbg:Debuginfo.t -> elt_kind:Lambda.bigarray_kind -> elt_size:int -> elt_chunk:Cmm.memory_chunk -> bigarray:Cmm.expression -> index:Cmm.expression -> Cmm.expression
val bigarray_store : dbg:Debuginfo.t -> elt_kind:Lambda.bigarray_kind -> elt_size:int -> elt_chunk:Cmm.memory_chunk -> bigarray:Cmm.expression -> index:Cmm.expression -> new_value:Cmm.expression -> Cmm.expression
val infix_field_address : dbg:Debuginfo.t -> Cmm.expression -> int -> Cmm.expression

infix_field_address ptr n dbg returns an expression for the address of the n-th field of the set of closures block pointed to by ptr. This function assumes that the n-1-th field of the block is an infix header, so that the returned address is in fact a correct ocaml value.

Data items

val cint : nativeint -> Cmm.data_item

Static integer.

val cint32 : int32 -> Cmm.data_item

Static 32-bit integer.

val cfloat32 : float -> Cmm.data_item

Static float32.

val cfloat : float -> Cmm.data_item

Static float.

Static 128-bit vector.

Static 256-bit vector.

Static 512-bit vector.

val symbol_address : Cmm.symbol -> Cmm.data_item

Static symbol.

val symbol_offset : Cmm.symbol -> int -> Cmm.data_item
val define_symbol : Cmm.symbol -> Cmm.data_item list

Definition for a static symbol.

Static structure helpers

fundecl name args body codegen_options dbg creates a cmm function declaration for a function name with binding args over body.

val cfunction : Cmm.fundecl -> Cmm.phrase

Create a cmm phrase for a function declaration.

val cdata : Cmm.data_item list -> Cmm.phrase

Create a cmm phrase for a static data item.

val gc_root_table : Cmm.symbol list -> Cmm.phrase

Create the gc root table from a list of root symbols.

val cmm_arith_size : Cmm.expression -> int option
val make_symbol : ?compilation_unit:Compilation_unit.t -> string -> string
val machtype_of_layout : Lambda.layout -> Cmm.machtype
val machtype_of_layout_changing_tagged_int_to_val : Lambda.layout -> Cmm.machtype
val make_tuple : Cmm.expression list -> Cmm.expression
val tuple_field : Cmm.expression -> component_tys:Cmm.machtype array -> int -> Debuginfo.t -> Cmm.expression
val curry_function : (Lambda.function_kind * Cmm.machtype list * Cmm.machtype) -> Cmm.phrase list
val send_function : (Cmm.machtype list * Cmm.machtype * Cmx_format.alloc_mode) -> Cmm.phrase
val apply_function : (Cmm.machtype list * Cmm.machtype * Cmx_format.alloc_mode) -> Cmm.phrase
val fail_if_called_indirectly_function : unit -> Cmm.phrase list
val atomic_exchange_field : dbg:Debuginfo.t -> Lambda.immediate_or_pointer -> Cmm.expression -> field:Cmm.expression -> new_value:Cmm.expression -> Cmm.expression
val atomic_fetch_and_add_field : dbg:Debuginfo.t -> Cmm.expression -> field:Cmm.expression -> Cmm.expression -> Cmm.expression
val atomic_add_field : dbg:Debuginfo.t -> Cmm.expression -> field:Cmm.expression -> Cmm.expression -> Cmm.expression
val atomic_sub_field : dbg:Debuginfo.t -> Cmm.expression -> field:Cmm.expression -> Cmm.expression -> Cmm.expression
val atomic_land_field : dbg:Debuginfo.t -> Cmm.expression -> field:Cmm.expression -> Cmm.expression -> Cmm.expression
val atomic_lor_field : dbg:Debuginfo.t -> Cmm.expression -> field:Cmm.expression -> Cmm.expression -> Cmm.expression
val atomic_lxor_field : dbg:Debuginfo.t -> Cmm.expression -> field:Cmm.expression -> Cmm.expression -> Cmm.expression
val atomic_compare_and_set_field : dbg:Debuginfo.t -> Lambda.immediate_or_pointer -> Cmm.expression -> field:Cmm.expression -> old_value:Cmm.expression -> new_value:Cmm.expression -> Cmm.expression
val atomic_compare_exchange_field : dbg:Debuginfo.t -> Lambda.immediate_or_pointer -> Cmm.expression -> field:Cmm.expression -> old_value:Cmm.expression -> new_value:Cmm.expression -> Cmm.expression
val emit_gc_roots_table : symbols:Cmm.symbol list -> Cmm.phrase list -> Cmm.phrase list
val perform : dbg:Debuginfo.t -> Cmm.expression -> Cmm.expression
val run_stack : dbg:Debuginfo.t -> stack:Cmm.expression -> f:Cmm.expression -> arg:Cmm.expression -> Cmm.expression
val resume : dbg:Debuginfo.t -> stack:Cmm.expression -> f:Cmm.expression -> arg:Cmm.expression -> last_fiber:Cmm.expression -> Cmm.expression
val reperform : dbg:Debuginfo.t -> eff:Cmm.expression -> cont:Cmm.expression -> last_fiber:Cmm.expression -> Cmm.expression
val allocate_unboxed_float32_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an unboxed float32 array for the given number of elements.

val allocate_untagged_int_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an untagged int array for the given number of elements.

val allocate_untagged_int8_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an untagged int8 array for the given number of elements.

val allocate_untagged_int16_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an untagged int16 array for the given number of elements.

val allocate_unboxed_int32_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an unboxed int32 array for the given number of elements.

val allocate_unboxed_int64_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an unboxed int64 array for the given number of elements.

val allocate_unboxed_nativeint_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an unboxed nativeint array for the given number of elements.

val allocate_unboxed_vec128_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an unboxed vec128 array for the given number of elements.

val allocate_unboxed_vec256_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an unboxed vec256 array for the given number of elements.

val allocate_unboxed_vec512_array : elements:Cmm.expression list -> Cmm.Alloc_mode.t -> Debuginfo.t -> Cmm.expression

Allocate a block to hold an unboxed vec512 array for the given number of elements.

val unboxed_float32_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an unboxed float32 array.

val untagged_int8_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an untagged int8 array.

val untagged_int16_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an untagged int16 array.

val unboxed_int32_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an unboxed int32 array.

val unboxed_or_untagged_int_or_int64_or_nativeint_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an untagged int or unboxed int64 or unboxed nativeint array.

val unboxed_vec128_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an unboxed vec128 array.

val unboxed_vec256_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an unboxed vec256 array.

val unboxed_vec512_array_length : Cmm.expression -> Debuginfo.t -> Cmm.expression

Compute the length of an unboxed vec512 array.

val unboxed_float32_array_ref : Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

Read from an unboxed float32 array (without bounds check).

val unboxed_mutable_float32_unboxed_product_array_ref : Cmm.expression -> array_index:Cmm.expression -> Debuginfo.t -> Cmm.expression

Read an unboxed float32 from a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The float32 is expected to be in the least significant bits of the 64-bit field. The most significant 32 bits of such field are ignored.

The zero-indexed element number is specified as a tagged immediate.

val unboxed_mutable_float32_unboxed_product_array_set : Cmm.expression -> array_index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Write an unboxed float32 into a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The zero-indexed element number is specified as a tagged immediate.

The float32 will be written to the least significant bits of the 64-bit field. The top 32 bits of the written word will be initialized to zero. Note that two writes are involved.

val untagged_int8_array_ref : Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

Read from an untagged int8 array (without bounds check).

val untagged_int16_array_ref : Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

Read from an untagged int16 array (without bounds check).

val unboxed_int32_array_ref : Cmm.expression -> Cmm.expression -> Debuginfo.t -> Cmm.expression

Read from an unboxed int32 array (without bounds check).

val untagged_mutable_int8_unboxed_product_array_ref : Cmm.expression -> array_index:Cmm.expression -> Debuginfo.t -> Cmm.expression

Read an untagged int8 from (the least significant bits of) a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The zero-indexed element number is specified as a tagged immediate.

The returned value is always sign extended, but it is not assumed that the 64-bit field in the array contains a sign-extended representation.

val untagged_mutable_int16_unboxed_product_array_ref : Cmm.expression -> array_index:Cmm.expression -> Debuginfo.t -> Cmm.expression

Read an untagged int16 from (the least significant bits of) a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The zero-indexed element number is specified as a tagged immediate.

The returned value is always sign extended, but it is not assumed that the 64-bit field in the array contains a sign-extended representation.

val unboxed_mutable_int32_unboxed_product_array_ref : Cmm.expression -> array_index:Cmm.expression -> Debuginfo.t -> Cmm.expression

Read an unboxed int32 from (the least significant bits of) a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The zero-indexed element number is specified as a tagged immediate.

The returned value is always sign extended, but it is not assumed that the 64-bit field in the array contains a sign-extended representation.

val untagged_mutable_int8_unboxed_product_array_set : Cmm.expression -> array_index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Write an untagged int8 into a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The zero-indexed element number is specified as a tagged immediate.

The write is done as a 64-bit write of a sign-extended version of the supplied new_value.

val untagged_mutable_int16_unboxed_product_array_set : Cmm.expression -> array_index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Write an untagged int16 into a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The zero-indexed element number is specified as a tagged immediate.

The write is done as a 64-bit write of a sign-extended version of the supplied new_value.

val unboxed_mutable_int32_unboxed_product_array_set : Cmm.expression -> array_index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Write an unboxed int32 into a 64-bit field in an array represented as a mixed block (with tag zero), as used for unboxed product arrays.

The zero-indexed element number is specified as a tagged immediate.

The write is done as a 64-bit write of a sign-extended version of the supplied new_value.

val unboxed_or_untagged_int_or_int64_or_nativeint_array_ref : Cmm.expression -> array_index:Cmm.expression -> Debuginfo.t -> Cmm.expression

Read from an untagged int, unboxed int64, or unboxed nativeint array (without bounds check).

The zero-indexed element number is specified as a tagged immediate.

A better name would be `naked_int_or_int64_or_nativeint_array_ref`, but this name was chosen for consistency.

val unboxed_float32_array_set : Cmm.expression -> index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Update an unboxed float32 array (without bounds check).

val untagged_int8_array_set : Cmm.expression -> index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Update an untagged int8 array (without bounds check).

val untagged_int16_array_set : Cmm.expression -> index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Update an untagged int16 array (without bounds check).

val unboxed_int32_array_set : Cmm.expression -> index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Update an unboxed int32 array (without bounds check).

val unboxed_or_untagged_int_or_int64_or_nativeint_array_set : Cmm.expression -> index:Cmm.expression -> new_value:Cmm.expression -> Debuginfo.t -> Cmm.expression

Update an unboxed int64 or unboxed nativeint or untagged int array (without bounds check).

Getters and setters for unboxed fields of mixed blocks

The first argument is the heap block to modify a field of. The index_in_words should be an untagged integer.

In contrast to setfield and setfield_computed, immediate_or_pointer is not needed as the layout is known from the memory_chunk argument, and initialization_or_assignment is not needed as unboxed ints can always be assigned without caml_modify (etc.).

val get_field_unboxed : dbg:Debuginfo.t -> Cmm.memory_chunk -> Asttypes.mutable_flag -> Cmm.expression -> index_in_words:Cmm.expression -> Cmm.expression
val set_field_unboxed : dbg:Debuginfo.t -> Cmm.memory_chunk -> Cmm.expression -> index_in_words:Cmm.expression -> Cmm.expression -> Cmm.expression
val dls_get : dbg:Debuginfo.t -> Cmm.expression
val tls_get : dbg:Debuginfo.t -> Cmm.expression
val cpu_relax : dbg:Debuginfo.t -> Cmm.expression
val poll : dbg:Debuginfo.t -> Cmm.expression
module Scalar_type : sig ... end

This module defines the various kinds of scalars usable in Cmm. It also provides ways to generate expressions to cast between them.