Module Js_of_ocaml_compiler.Code

module Addr : sig ... end
module DebugAddr : sig ... end
module Var : sig ... end
type cont = Addr.t * Var.t list
type prim =
| Vectlength
| Array_get
| Extern of string
| Not
| IsInt
| Eq
| Neq
| Lt
| Le
| Ult
type array_or_not =
| Array
| NotArray
| Unknown
module Native_string : sig ... end
type constant =
| String of string
| NativeString of Native_string.t
| Float of float
| Float_array of float array
| Int64 of int64
| Tuple of int * constant array * array_or_not
| Int of int32
val constant_equal : constant -> constant -> bool option
type loc =
| No
| Before of Addr.t
| After of Addr.t
val noloc : loc
val location_of_pc : int -> loc
type prim_arg =
| Pv of Var.t
| Pc of constant
type expr =
| Apply of {
f : Var.t;
args : Var.t list;
exact : bool;
}
| Block of int * Var.t array * array_or_not
| Field of Var.t * int
| Closure of Var.t list * cont
| Constant of constant
| Prim of prim * prim_arg list
type instr =
| Let of Var.t * expr
| Assign of Var.t * Var.t
| Set_field of Var.t * int * Var.t
| Offset_ref of Var.t * int
| Array_set of Var.t * Var.t * Var.t
type last =
| Return of Var.t
| Raise of Var.t * [ `Normal | `Notrace | `Reraise ]
| Stop
| Branch of cont
| Cond of Var.t * cont * cont
| Switch of Var.t * cont array * cont array
| Pushtrap of cont * Var.t * cont * Addr.Set.t
| Poptrap of cont
type block = {
params : Var.t list;
body : (instr * loc) list;
branch : last * loc;
}
type program = {
start : Addr.t;
blocks : block Addr.Map.t;
free_pc : Addr.t;
}
module Print : sig ... end
type 'c fold_blocs = block Addr.Map.t -> Addr.t -> ( Addr.t -> 'c -> 'c ) -> 'c -> 'c
type fold_blocs_poly = {
fold : 'a. 'a fold_blocs;
}
val fold_closures : program -> ( Var.t option -> Var.t list -> cont -> 'd -> 'd ) -> 'd -> 'd

fold_closures p f init folds f over all closures in the program p, starting from the initial value init. For each closure, f is called with the following arguments: the closure name (enclosed in Stdlib.Some), its parameter list, the address and parameter instantiation of its first block, and the current accumulator. In addition, f is called on the initial block p.start, with None as the closure name. All closures in all blocks of p are included in the fold, not only the ones reachable from p.start.

val fold_closures_innermost_first : program -> ( Var.t option -> Var.t list -> cont -> 'd -> 'd ) -> 'd -> 'd

Similar to fold_closures, but applies the fold function to the innermost closures first. Unlike with fold_closures, only the closures reachable from p.start are considered.

val fold_children : 'c fold_blocs
val traverse : fold_blocs_poly -> ( Addr.t -> 'c -> 'c ) -> Addr.t -> block Addr.Map.t -> 'c -> 'c
val preorder_traverse : fold_blocs_poly -> ( Addr.t -> 'c -> 'c ) -> Addr.t -> block Addr.Map.t -> 'c -> 'c
val prepend : program -> (instr * loc) list -> program
val empty : program
val is_empty : program -> bool
val eq : program -> program -> bool
val invariant : program -> unit