package spotlib

  1. Overview
  2. Docs
include module type of struct include Obj end
type t = Obj.t
val repr : 'a -> t
val obj : t -> 'a
val magic : 'a -> 'b
val is_block : t -> bool
val is_int : t -> bool
val tag : t -> int
val size : t -> int
val 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 excluded.

@Since 4.04

val field : t -> int -> t
val 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 and set_tag. However, for 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.

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.

val set_tag : t -> int -> unit
  • deprecated Use with_tag instead.
val double_field : t -> int -> float
val set_double_field : t -> int -> float -> unit
val new_block : int -> int -> t
val dup : t -> t
val truncate : t -> int -> unit
  • deprecated
val add_offset : t -> Int32.t -> t
val with_tag : int -> t -> t
val first_non_constant_constructor_tag : int
val last_non_constant_constructor_tag : int
val lazy_tag : int
val closure_tag : int
val object_tag : int
val infix_tag : int
val forward_tag : int
val no_scan_tag : int
val abstract_tag : int
val string_tag : int
val double_tag : int
val double_array_tag : int
val custom_tag : int
val final_tag : int
  • deprecated Replaced by custom_tag.
val int_tag : int
val out_of_heap_tag : int
val unaligned_tag : int
module Extension_constructor = Obj.Extension_constructor
val extension_constructor : 'a -> extension_constructor
  • deprecated use Obj.Extension_constructor.of_val
val extension_name : extension_constructor -> string
  • deprecated use Obj.Extension_constructor.name
val extension_id : extension_constructor -> int
  • deprecated use Obj.Extension_constructor.id

The following two functions are deprecated. Use module Marshal instead.

val marshal : t -> bytes
  • deprecated Use Marshal.to_bytes instead.
val unmarshal : bytes -> int -> t * int
  • deprecated Use Marshal.from_bytes and Marshal.total_size instead.
module Ephemeron = Obj.Ephemeron
include module type of struct include Xobj end
type tag = Xobj.tag =
  1. | Abstract
  2. | Closure
  3. | Custom
  4. | Double
  5. | Double_array
  6. | Forward
  7. | Infix
  8. | Int
  9. | Lazy
  10. | No_scan
  11. | Object
  12. | Out_of_heap
  13. | String
  14. | Unaligned
  15. | Unknown of int
val parse_tag : int -> tag
val tag_name : tag -> string
val dump : Obj.t -> unit
OCaml

Innovation. Community. Security.