Page
Library
Module
Module type
Parameter
Class
Class type
Source
Memgraph.ReprSourceRepresentation of ocaml values
This module aims at given a way to inspect the memory layout of ocaml values by providing some type to represent memory layouts, and some functions to convert arbitrary ocaml values into their explicit memory representation.
Ocaml tags
Abstract addresses, used for sharing
Contents of the closure info field, stored for each closure in a set of closures.
Represent OCaml blocks.
To have a high-level representation of a block's fields, we distinguish three cases:
and _ cell = | Int : int -> [< `Inline | `Direct ] cellIntegers
*)| Pointer : addr -> [< `Inline | `Direct ] cellPointers to some block
*)| External : Nativeint.t -> [< `Inline ] cellOut of heap pointer
*)| String : string -> [< `Block ] cellString
*)| Double : float -> [< `Block | `Inline ] cellA float
*)| Infix : [ `Inline ] cellAn infix header (used in closures)
*)| Closinfo : closinfo -> [< `Inline ] cellClosure info field
*)The actual type of memory cells containing concrete values. There are actually three type of cells:
`Direct cells are values that can be found in ocaml variables`Inline cells are values that can be found in a block's field array`Block cells are "big" values that take a whole blockObviously, some constructors can build more than one type of cells.
type pblock = private {block : block;The block being pointed at
*)offset : int;The offset in the block (used in mutually rec closures)
*)}This represents what is pointed at by a pointer. This is useful considering that an ocaml value can point at a closure within a set of closures, and thus point in the middle of an ocaml value (since there is an infix header, the value being pointed to is also an ocaml value, but things are easier to represent this way).
Apply the given function to a block, and all the blocks it points to (recursively). Each block is visited exactly once (the order is left unspecified though).
A type containing a function to create cells.