Module Stdlib.ObjSource
Operations on internal representations of values.
Not for the casual user.
Sourcetype raw_data = nativeint Sourceval repr : 'a -> t @@ portable Sourceval 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 @ unique @@ portable Sourceval magic_many : 'a @ once -> 'a @@ portable Sourceval magic_at_unique : 'a @ unique -> 'b @ unique @@ portable Sourceval is_block : t @ contended -> bool @@ portable Sourceval is_int : t @ contended -> bool @@ portable Sourceval tag : t @ contended -> int @@ portable Sourceval size : t @ contended -> int @@ portable Sourceval reachable_words : 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.
Sourceval uniquely_reachable_words : 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 : t -> int -> t @@ portable Sourceval set_field : t -> int -> 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 : t -> int -> float @@ portable Sourceval set_double_field : t -> int -> float -> unit @@ portable Sourceval new_block : int -> int -> t @@ portable dup t returns a shallow copy of t. However if t is immutable then it might be returned unchanged.
Sourceval with_tag : int -> t -> 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 Ephemeron with arbitrary arity and untyped
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.