Module Stdlib.ObjSource

Operations on internal representations of values.

Not for the casual user.

Sourcetype t
Sourcetype raw_data = nativeint
Sourceval repr : 'a -> t
Sourceval obj : t -> 'a
Sourceval magic : 'a -> 'b
Sourceval is_block : t -> bool
Sourceval is_int : t -> bool
Sourceval tag : t -> int
Sourceval size : t -> int
Sourceval reachable_words : t -> int

Computes the total size (in words, including the headers) of all heap blocks accessible from the argument. Statically allocated blocks are included.

  • since 4.04
Sourceval field : t -> int -> t
Sourceval set_field : t -> int -> t -> unit

When using flambda:

set_field MUST NOT be called on immutable blocks. (Blocks allocated in C stubs, or with new_block below, are always considered mutable.)

The same goes for set_double_field.

For experts only: set_field et al can be made safe by first wrapping the block in Sys.opaque_identity, so any information about its contents will not be propagated.

Sourceval double_field : t -> int -> float
Sourceval set_double_field : t -> int -> float -> unit
Sourceval raw_field : t -> int -> raw_data
Sourceval set_raw_field : t -> int -> raw_data -> unit
Sourceval new_block : int -> int -> t
Sourceval dup : t -> t
Sourceval add_offset : t -> Int32.t -> t
Sourceval with_tag : int -> t -> t
Sourceval first_non_constant_constructor_tag : int
Sourceval last_non_constant_constructor_tag : int
Sourceval forcing_tag : int
Sourceval cont_tag : int
Sourceval lazy_tag : int
Sourceval closure_tag : int
Sourceval object_tag : int
Sourceval infix_tag : int
Sourceval forward_tag : int
Sourceval no_scan_tag : int
Sourceval abstract_tag : int
Sourceval string_tag : int
Sourceval double_tag : int
Sourceval double_array_tag : int
Sourceval custom_tag : int
Sourceval int_tag : int
Sourceval out_of_heap_tag : int
Sourceval unaligned_tag : int
Sourcemodule Extension_constructor : sig ... end
Sourcemodule Ephemeron : sig ... end

Ephemeron with arbitrary arity and untyped