jon.recoil.org

Module Stdlib.ObjSource

Operations on internal representations of values.

Not for the casual user.

Sourcetype t
Sourcetype raw_data = nativeint
Sourceval repr : 'a -> Stdlib.Obj.t @@ portable
Sourceval obj : Stdlib.Obj.t -> 'a @@ portable
Sourceval magic : 'a -> 'b @@ portable
Sourceval magic_portable : 'a -> 'a @ portable @@ portable
Sourceval magic_uncontended : 'a @ contended -> 'a @@ portable
Sourceval magic_unique : 'a -> 'a @ portable @@ portable
Sourceval magic_many : 'a @ once -> 'a @@ portable
Sourceval magic_at_unique : 'a @ portable -> 'b @ portable @@ portable
Sourceval is_block : Stdlib.Obj.t @ contended -> bool @@ portable
Sourceval is_int : Stdlib.Obj.t @ contended -> bool @@ portable
Sourceval tag : Stdlib.Obj.t @ contended -> int @@ portable
Sourceval size : Stdlib.Obj.t @ contended -> int @@ portable
Sourceval reachable_words : Stdlib.Obj.t -> int @@ portable

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 uniquely_reachable_words : Stdlib.Obj.t array -> int array * int @@ portable

For each element of the array, computes the total size (as defined above by reachable_words) of all heap blocks accessible from the argument but excluding all blocks accessible from any other arguments.

Also returns a single number denoting the total memory reachable from at least two of the roots. We make no attempt to classify which two (or more) roots are responsible for this memory.

Sourceval field : Stdlib.Obj.t -> int -> Stdlib.Obj.t @@ portable
Sourceval set_field : Stdlib.Obj.t -> int -> Stdlib.Obj.t -> unit @@ portable

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 : Stdlib.Obj.t -> int -> float @@ portable
Sourceval set_double_field : Stdlib.Obj.t -> int -> float -> unit @@ portable
Sourceval raw_field : Stdlib.Obj.t -> int -> Stdlib.Obj.raw_data @@ portable
Sourceval set_raw_field : Stdlib.Obj.t -> int -> Stdlib.Obj.raw_data -> unit @@ portable
Sourceval new_block : int -> int -> Stdlib.Obj.t @@ portable
Sourceval dup : Stdlib.Obj.t -> Stdlib.Obj.t @@ portable

dup t returns a shallow copy of t. However if t is immutable then it might be returned unchanged.

Sourceval add_offset : Stdlib.Obj.t -> Stdlib.Int32.t -> Stdlib.Obj.t @@ portable
Sourceval with_tag : int -> Stdlib.Obj.t -> Stdlib.Obj.t @@ portable
Sourceval first_non_constant_constructor_tag : int @@ portable
Sourceval last_non_constant_constructor_tag : int @@ portable
Sourceval forcing_tag : int @@ portable
Sourceval cont_tag : int @@ portable
Sourceval lazy_tag : int @@ portable
Sourceval closure_tag : int @@ portable
Sourceval object_tag : int @@ portable
Sourceval infix_tag : int @@ portable
Sourceval forward_tag : int @@ portable
Sourceval no_scan_tag : int @@ portable
Sourceval abstract_tag : int @@ portable
Sourceval string_tag : int @@ portable
Sourceval double_tag : int @@ portable
Sourceval double_array_tag : int @@ portable
Sourceval custom_tag : int @@ portable
Sourceval int_tag : int @@ portable
Sourceval out_of_heap_tag : int @@ portable
Sourceval unaligned_tag : int @@ portable
Sourcemodule Extension_constructor : sig ... end
Sourcemodule Ephemeron : sig ... end

Ephemeron with arbitrary arity and untyped

Sourcemodule Uniform_or_mixed : sig ... end

Blocks with a nominally scannable tag can still have a suffix of unscanned objects; such a block is "mixed". This contrasts with "uniform" blocks which are either all-scanned or all-unscanned.