.TH "Obj" 3o 2020-01-30 OCamldoc "OCaml library"
.SH NAME
Obj \- Operations on internal representations of values.
.SH Module
Module   Obj
.SH Documentation
.sp
Module
.BI "Obj"
 : 
.B sig  end

.sp
Operations on internal representations of values\&.
.sp
Not for the casual user\&.

.sp

.sp
.sp
.I type t 

.sp

.sp

.I val repr 
: 
.B 'a -> t
.sp

.sp

.I val obj 
: 
.B t -> 'a
.sp

.sp

.I val magic 
: 
.B 'a -> 'b
.sp

.sp

.I val is_block 
: 
.B t -> bool
.sp

.sp

.I val is_int 
: 
.B t -> bool
.sp

.sp

.I val tag 
: 
.B t -> int
.sp

.sp

.I val size 
: 
.B t -> int
.sp

.sp

.I val reachable_words 
: 
.B t -> int
.sp
Computes the total size (in words, including the headers) of all
heap blocks accessible from the argument\&.  Statically
allocated blocks are excluded\&.
.sp
@Since 4\&.04

.sp

.I val field 
: 
.B t -> int -> t
.sp

.sp

.I val set_field 
: 
.B t -> int -> t -> unit
.sp
When using flambda:
.sp

.B set_field
MUST NOT be called on immutable blocks\&.  (Blocks allocated
in C stubs, or with 
.B new_block
below, are always considered mutable\&.)
.sp
The same goes for 
.B set_double_field
and 
.B set_tag
\&.  However, for
.B set_tag
, in the case of immutable blocks where the middle\-end optimizers
never see code that discriminates on their tag (for example records), the
operation should be safe\&.  Such uses are nonetheless discouraged\&.
.sp
For experts only:
.B set_field
et al can be made safe by first wrapping the block in
.B Sys\&.opaque_identity
, so any information about its contents will not
be propagated\&.

.sp

.I val set_tag 
: 
.B t -> int -> unit
.sp

.sp

.I val double_field 
: 
.B t -> int -> float
.sp

.sp

.I val set_double_field 
: 
.B t -> int -> float -> unit
.sp

.sp

.I val new_block 
: 
.B int -> int -> t
.sp

.sp

.I val dup 
: 
.B t -> t
.sp

.sp

.I val truncate 
: 
.B t -> int -> unit
.sp

.sp

.I val add_offset 
: 
.B t -> Int32.t -> t
.sp

.sp

.I val first_non_constant_constructor_tag 
: 
.B int
.sp

.sp

.I val last_non_constant_constructor_tag 
: 
.B int
.sp

.sp

.I val lazy_tag 
: 
.B int
.sp

.sp

.I val closure_tag 
: 
.B int
.sp

.sp

.I val object_tag 
: 
.B int
.sp

.sp

.I val infix_tag 
: 
.B int
.sp

.sp

.I val forward_tag 
: 
.B int
.sp

.sp

.I val no_scan_tag 
: 
.B int
.sp

.sp

.I val abstract_tag 
: 
.B int
.sp

.sp

.I val string_tag 
: 
.B int
.sp

.sp

.I val double_tag 
: 
.B int
.sp

.sp

.I val double_array_tag 
: 
.B int
.sp

.sp

.I val custom_tag 
: 
.B int
.sp

.sp

.I val final_tag 
: 
.B int
.sp

.sp

.I val int_tag 
: 
.B int
.sp

.sp

.I val out_of_heap_tag 
: 
.B int
.sp

.sp

.I val unaligned_tag 
: 
.B int
.sp

.sp
.I module Extension_constructor : 
.B sig  end

.sp

.sp

.I val extension_constructor 
: 
.B 'a -> extension_constructor
.sp

.sp

.I val extension_name 
: 
.B extension_constructor -> string
.sp

.sp

.I val extension_id 
: 
.B extension_constructor -> int
.sp

.sp

.PP
The following two functions are deprecated\&.  Use module 
.B Marshal
instead\&.
.PP

.I val marshal 
: 
.B t -> bytes
.sp

.sp

.I val unmarshal 
: 
.B bytes -> int -> t * int
.sp

.sp
.I module Ephemeron : 
.B sig  end

.sp

.sp
