package ocaml-base-compiler

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

Exported information (that is to say, information written into a .cmx file) about a compilation unit.

type value_string_contents =
  1. | Contents of string
  2. | Unknown_or_mutable
type value_string = {
  1. contents : value_string_contents;
  2. size : int;
}
type value_float_array_contents =
  1. | Contents of float option array
  2. | Unknown_or_mutable
type value_float_array = {
  1. contents : value_float_array_contents;
  2. size : int;
}
type descr =
  1. | Value_block of Tag.t * approx array
  2. | Value_mutable_block of Tag.t * int
  3. | Value_int of int
  4. | Value_char of char
  5. | Value_float of float
  6. | Value_float_array of value_float_array
  7. | Value_boxed_int : 'a A.boxed_int * 'a -> descr
  8. | Value_string of value_string
  9. | Value_closure of value_closure
  10. | Value_set_of_closures of value_set_of_closures
  11. | Value_unknown_descr
and value_closure = {
  1. closure_id : Closure_id.t;
  2. set_of_closures : value_set_of_closures;
}
and value_set_of_closures = {
  1. set_of_closures_id : Set_of_closures_id.t;
  2. bound_vars : approx Var_within_closure.Map.t;
  3. free_vars : Flambda.specialised_to Variable.Map.t;
  4. results : approx Closure_id.Map.t;
  5. aliased_symbol : Symbol.t option;
}
and approx =
  1. | Value_unknown
  2. | Value_id of Export_id.t
  3. | Value_symbol of Symbol.t
type t = private {
  1. sets_of_closures : A.function_declarations Set_of_closures_id.Map.t;
    (*

    Code of exported functions indexed by set of closures IDs.

    *)
  2. values : descr Export_id.Map.t Compilation_unit.Map.t;
    (*

    Structure of exported values.

    *)
  3. symbol_id : Export_id.t Symbol.Map.t;
    (*

    Associates symbols and values.

    *)
  4. offset_fun : int Closure_id.Map.t;
    (*

    Positions of function pointers in their closures.

    *)
  5. offset_fv : int Var_within_closure.Map.t;
    (*

    Positions of value pointers in their closures.

    *)
  6. constant_closures : Closure_id.Set.t;
  7. invariant_params : Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t;
  8. recursive : Variable.Set.t Set_of_closures_id.Map.t;
}

A structure that describes what a single compilation unit exports.

type transient = private {
  1. sets_of_closures : A.function_declarations Set_of_closures_id.Map.t;
  2. values : descr Export_id.Map.t Compilation_unit.Map.t;
  3. symbol_id : Export_id.t Symbol.Map.t;
  4. invariant_params : Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t;
  5. recursive : Variable.Set.t Set_of_closures_id.Map.t;
  6. relevant_local_closure_ids : Closure_id.Set.t;
  7. relevant_imported_closure_ids : Closure_id.Set.t;
  8. relevant_local_vars_within_closure : Var_within_closure.Set.t;
  9. relevant_imported_vars_within_closure : Var_within_closure.Set.t;
}
val empty : t

Export information for a compilation unit that exports nothing.

val opaque_transient : compilation_unit:Compilation_unit.t -> root_symbol:Symbol.t -> transient

Create a new export information structure.

val create_transient : sets_of_closures:A.function_declarations Set_of_closures_id.Map.t -> values:descr Export_id.Map.t Compilation_unit.Map.t -> symbol_id:Export_id.t Symbol.Map.t -> invariant_params:Variable.Set.t Variable.Map.t Set_of_closures_id.Map.t -> recursive:Variable.Set.t Set_of_closures_id.Map.t -> relevant_local_closure_ids:Closure_id.Set.t -> relevant_imported_closure_ids:Closure_id.Set.t -> relevant_local_vars_within_closure:Var_within_closure.Set.t -> relevant_imported_vars_within_closure:Var_within_closure.Set.t -> transient
val t_of_transient : transient -> program:Flambda.program -> local_offset_fun:int Closure_id.Map.t -> local_offset_fv:int Var_within_closure.Map.t -> imported_offset_fun:int Closure_id.Map.t -> imported_offset_fv:int Var_within_closure.Map.t -> constant_closures:Closure_id.Set.t -> t

Record information about the layout of closures and which sets of closures are constant. These are all worked out during the Flambda_to_clambda pass.

val merge : t -> t -> t

Union of export information. Verifies that there are no identifier clashes.

val find_description : t -> Export_id.t -> descr

Look up the description of an exported value given its export ID.

Partition a mapping from export IDs by compilation unit.

OCaml

Innovation. Community. Security.