jon.recoil.org

Module Flambda2_simplify_shared.Exported_offsets

type t

Public state to store the mapping from elements of a closure to offset.

type words = int
type function_slot_info =
  1. | Dead_function_slot
  2. | Live_function_slot of {
    1. offset : words;
    2. size : words;
    }
type value_slot_info =
  1. | Dead_value_slot
  2. | Live_value_slot of {
    1. offset : words;
    2. size : words;
    3. is_scanned : bool;
    }
val empty : t

The empty environment

val print : Format.formatter -> t -> unit

Printing function for environment.

val value_slot_offset : t -> Flambda2_identifiers.Value_slot.t -> value_slot_info option

Returns the offset computed for a value slot, in terms of target architecture words.

If None is returned, there is no set of closures in the program containing the given value slot.

val function_slot_offset : t -> Flambda2_identifiers.Function_slot.t -> function_slot_info option

Returns the offset computed for a function slot, in terms of target architecture words.

This points to the first field of the representation of the function slot within the Closure_tag block. Notably, if the offset is not 0, an infix header must be placed just before the returned offset.

If None is returned, there is no set of closures in the program containing the given function slot.

val add_function_slot_offset : t -> Flambda2_identifiers.Function_slot.t -> function_slot_info -> t

Record the assignment of the given offset to the given function slot

val add_value_slot_offset : t -> Flambda2_identifiers.Value_slot.t -> value_slot_info -> t

Record the assignment of the given offset to the given value slot

Build maps from the underlying data

val import_offsets : t -> unit

Take the offsets read from a cmx file and add them to the current state

val imported_offsets : unit -> t

Return all the offsets read from cmx files so far

val merge : t -> t -> t

Merge the offsets from two files

val reexport_function_slots : Flambda2_identifiers.Function_slot.Set.t -> t -> t

Ensure the offsets for the given function slots are in the given exported offsets.

val reexport_value_slots : Flambda2_identifiers.Value_slot.Set.t -> t -> t

Ensure the offsets for the given function slots are in the given exported offsets.