package ocaml-base-compiler

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

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 excluded, unless the runtime system was configured with --disable-naked-pointers.

  • 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 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.

Sourceval set_tag : t -> int -> unit
  • deprecated Use with_tag instead.
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 truncate : t -> int -> unit
  • deprecated
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 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 final_tag : int
  • deprecated Replaced by custom_tag.
Sourceval int_tag : int
Sourceval out_of_heap_tag : int
Sourceval unaligned_tag : int
Sourcemodule Closure : sig ... end
Sourcemodule Extension_constructor : sig ... end
Sourceval extension_constructor : 'a -> extension_constructor
  • deprecated use Obj.Extension_constructor.of_val
Sourceval extension_name : extension_constructor -> string
  • deprecated use Obj.Extension_constructor.name
Sourceval extension_id : extension_constructor -> int
  • deprecated use Obj.Extension_constructor.id
Sourcemodule Ephemeron : sig ... end

Ephemeron with arbitrary arity and untyped

OCaml

Innovation. Community. Security.