Module Lambda
type primitive = | Pbytes_to_string| Pbytes_of_string| Pignore| Pgetglobal of Ident.t| Psetglobal of Ident.t| Pmakeblock of int * Asttypes.mutable_flag * Lambda.block_shape| Pmakelazyblock of Lambda.lazy_block_tag| Pfield of int * Lambda.immediate_or_pointer * Asttypes.mutable_flag| Pfield_computed| Psetfield of int * Lambda.immediate_or_pointer * Lambda.initialization_or_assignment| Psetfield_computed of Lambda.immediate_or_pointer * Lambda.initialization_or_assignment| Pfloatfield of int| Psetfloatfield of int * Lambda.initialization_or_assignment| Pduprecord of Types.record_representation * int| Prunstack| Pperform| Presume| Preperform| Pccall of Primitive.description| Praise of Lambda.raise_kind| Psequand| Psequor| Pnot| Pnegint| Paddint| Psubint| Pmulint| Pdivint of Lambda.is_safe| Pmodint of Lambda.is_safe| Pandint| Porint| Pxorint| Plslint| Plsrint| Pasrint| Pintcomp of Lambda.integer_comparison| Pcompare_ints| Pcompare_floats| Pcompare_bints of Lambda.boxed_integer| Poffsetint of int| Poffsetref of int| Pintoffloat| Pfloatofint| Pnegfloat| Pabsfloat| Paddfloat| Psubfloat| Pmulfloat| Pdivfloat| Pfloatcomp of Lambda.float_comparison| Pstringlength| Pstringrefu| Pstringrefs| Pbyteslength| Pbytesrefu| Pbytessetu| Pbytesrefs| Pbytessets| Pmakearray of Lambda.array_kind * Asttypes.mutable_flag| Pduparray of Lambda.array_kind * Asttypes.mutable_flag(*For
*)Pduparray, the argument must be an immutable array. The arguments ofPduparraygive the kind and mutability of the array being *produced* by the duplication.| Parraylength of Lambda.array_kind| Parrayrefu of Lambda.array_kind| Parraysetu of Lambda.array_kind| Parrayrefs of Lambda.array_kind| Parraysets of Lambda.array_kind| Pisint| Pisout| Pbintofint of Lambda.boxed_integer| Pintofbint of Lambda.boxed_integer| Pcvtbint of Lambda.boxed_integer * Lambda.boxed_integer| Pnegbint of Lambda.boxed_integer| Paddbint of Lambda.boxed_integer| Psubbint of Lambda.boxed_integer| Pmulbint of Lambda.boxed_integer| Pdivbint of {size : Lambda.boxed_integer;is_safe : Lambda.is_safe;
}| Pmodbint of {size : Lambda.boxed_integer;is_safe : Lambda.is_safe;
}| Pandbint of Lambda.boxed_integer| Porbint of Lambda.boxed_integer| Pxorbint of Lambda.boxed_integer| Plslbint of Lambda.boxed_integer| Plsrbint of Lambda.boxed_integer| Pasrbint of Lambda.boxed_integer| Pbintcomp of Lambda.boxed_integer * Lambda.integer_comparison| Pbigarrayref of bool * int * Lambda.bigarray_kind * Lambda.bigarray_layout| Pbigarrayset of bool * int * Lambda.bigarray_kind * Lambda.bigarray_layout| Pbigarraydim of int| Pstring_load_16 of bool| Pstring_load_32 of bool| Pstring_load_64 of bool| Pbytes_load_16 of bool| Pbytes_load_32 of bool| Pbytes_load_64 of bool| Pbytes_set_16 of bool| Pbytes_set_32 of bool| Pbytes_set_64 of bool| Pbigstring_load_16 of bool| Pbigstring_load_32 of bool| Pbigstring_load_64 of bool| Pbigstring_set_16 of bool| Pbigstring_set_32 of bool| Pbigstring_set_64 of bool| Pctconst of Lambda.compile_time_constant| Pbswap16| Pbbswap of Lambda.boxed_integer| Pint_as_pointer| Patomic_load| Popaque| Pdls_get| Ppoll
and block_shape = Lambda.value_kind list optionval equal_primitive : Lambda.primitive -> Lambda.primitive -> boolval equal_value_kind : Lambda.value_kind -> Lambda.value_kind -> boolval equal_boxed_integer : Lambda.boxed_integer -> Lambda.boxed_integer -> booltype structured_constant = | Const_base of Asttypes.constant| Const_block of int * Lambda.structured_constant list| Const_float_array of string list| Const_immstring of string
val equal_inline_attribute :
Lambda.inline_attribute ->
Lambda.inline_attribute ->
boolval equal_specialise_attribute :
Lambda.specialise_attribute ->
Lambda.specialise_attribute ->
boolval equal_meth_kind : Lambda.meth_kind -> Lambda.meth_kind -> booltype function_attribute = {inline : Lambda.inline_attribute;specialise : Lambda.specialise_attribute;local : Lambda.local_attribute;poll : Lambda.poll_attribute;is_a_functor : bool;stub : bool;tmc_candidate : bool;may_fuse_arity : bool;
}type scoped_location = Debuginfo.Scoped_location.ttype lambda = | Lvar of Ident.t| Lmutvar of Ident.t| Lconst of Lambda.structured_constant| Lapply of Lambda.lambda_apply| Lfunction of Lambda.lfunction| Llet of Lambda.let_kind * Lambda.value_kind * Ident.t * Lambda.lambda * Lambda.lambda| Lmutlet of Lambda.value_kind * Ident.t * Lambda.lambda * Lambda.lambda| Lletrec of Lambda.rec_binding list * Lambda.lambda| Lprim of Lambda.primitive * Lambda.lambda list * Lambda.scoped_location| Lswitch of Lambda.lambda * Lambda.lambda_switch * Lambda.scoped_location| Lstringswitch of Lambda.lambda * (string * Lambda.lambda) list * Lambda.lambda option * Lambda.scoped_location| Lstaticraise of int * Lambda.lambda list| Lstaticcatch of Lambda.lambda * int * (Ident.t * Lambda.value_kind) list * Lambda.lambda| Ltrywith of Lambda.lambda * Ident.t * Lambda.lambda| Lifthenelse of Lambda.lambda * Lambda.lambda * Lambda.lambda| Lsequence of Lambda.lambda * Lambda.lambda| Lwhile of Lambda.lambda * Lambda.lambda| Lfor of Ident.t * Lambda.lambda * Lambda.lambda * Asttypes.direction_flag * Lambda.lambda| Lassign of Ident.t * Lambda.lambda| Lsend of Lambda.meth_kind * Lambda.lambda * Lambda.lambda * Lambda.lambda list * Lambda.scoped_location| Levent of Lambda.lambda * Lambda.lambda_event| Lifused of Ident.t * Lambda.lambda
and lfunction = private {kind : Lambda.function_kind;params : (Ident.t * Lambda.value_kind) list;return : Lambda.value_kind;body : Lambda.lambda;attr : Lambda.function_attribute;loc : Lambda.scoped_location;
}and lambda_apply = {ap_func : Lambda.lambda;ap_args : Lambda.lambda list;ap_loc : Lambda.scoped_location;ap_tailcall : Lambda.tailcall_attribute;ap_inlined : Lambda.inline_attribute;ap_specialised : Lambda.specialise_attribute;
}and lambda_switch = {sw_numconsts : int;sw_consts : (int * Lambda.lambda) list;sw_numblocks : int;sw_blocks : (int * Lambda.lambda) list;sw_failaction : Lambda.lambda option;
}and lambda_event = {lev_loc : Lambda.scoped_location;lev_kind : Lambda.lambda_event_kind;lev_repr : int Stdlib.ref option;lev_env : Env.t;
}type program = {module_ident : Ident.t;main_module_block_size : int;required_globals : Ident.Set.t;code : Lambda.lambda;
}val make_key : Lambda.lambda -> Lambda.lambda optionval const_unit : Lambda.structured_constantval const_int : int -> Lambda.structured_constantval lambda_unit : Lambda.lambdaval dummy_constant : Lambda.lambdadummy_constant produces a plecholder value with a recognizable bit pattern (currently 0xBBBB in its tagged form)
val name_lambda :
Lambda.let_kind ->
Lambda.lambda ->
(Ident.t -> Lambda.lambda) ->
Lambda.lambdaval name_lambda_list :
Lambda.lambda list ->
(Lambda.lambda list -> Lambda.lambda) ->
Lambda.lambdaval lfunction :
kind:Lambda.function_kind ->
params:(Ident.t * Lambda.value_kind) list ->
return:Lambda.value_kind ->
body:Lambda.lambda ->
attr:Lambda.function_attribute ->
loc:Lambda.scoped_location ->
Lambda.lambdaval lfunction' :
kind:Lambda.function_kind ->
params:(Ident.t * Lambda.value_kind) list ->
return:Lambda.value_kind ->
body:Lambda.lambda ->
attr:Lambda.function_attribute ->
loc:Lambda.scoped_location ->
Lambda.lfunctionval iter_head_constructor : (Lambda.lambda -> unit) -> Lambda.lambda -> unititer_head_constructor f lam apply f to only the first level of sub expressions of lam. It does not recursively traverse the expression.
val shallow_iter :
tail:(Lambda.lambda -> unit) ->
non_tail:(Lambda.lambda -> unit) ->
Lambda.lambda ->
unitSame as iter_head_constructor, but use a different callback for sub-terms which are in tail position or not.
val transl_prim : string -> string -> Lambda.lambdaTranslate a value from a persistent module. For instance:
transl_prim "CamlinternalLazy" "force"val is_evaluated : Lambda.lambda -> boolis_evaluated lam returns true if lam is either a constant, a variable or a function abstract.
val free_variables : Lambda.lambda -> Ident.Set.tval transl_module_path :
Lambda.scoped_location ->
Env.t ->
Path.t ->
Lambda.lambdaval transl_value_path :
Lambda.scoped_location ->
Env.t ->
Path.t ->
Lambda.lambdaval transl_extension_path :
Lambda.scoped_location ->
Env.t ->
Path.t ->
Lambda.lambdaval transl_class_path :
Lambda.scoped_location ->
Env.t ->
Path.t ->
Lambda.lambdaval make_sequence : ('a -> Lambda.lambda) -> 'a list -> Lambda.lambdaval subst :
(Ident.t -> Types.value_description -> Env.t -> Env.t) ->
?freshen_bound_variables:bool ->
Lambda.lambda Ident.Map.t ->
Lambda.lambda ->
Lambda.lambdasubst update_env ?freshen_bound_variables s lt applies a substitution s to the lambda-term lt.
Assumes that the image of the substitution is out of reach of the bound variables of the lambda-term (no capture).
update_env is used to refresh the environment contained in debug events.
freshen_bound_variables, which defaults to false, freshens the bound variables within lt.
val rename : Ident.t Ident.Map.t -> Lambda.lambda -> Lambda.lambdaA version of subst specialized for the case where we're just renaming idents.
val duplicate_function : Lambda.lfunction -> Lambda.lfunctionDuplicate a term, freshening all locally-bound identifiers.
val map : (Lambda.lambda -> Lambda.lambda) -> Lambda.lambda -> Lambda.lambdaBottom-up rewriting, applying the function on each node from the leaves to the root.
val map_lfunction :
(Lambda.lambda -> Lambda.lambda) ->
Lambda.lfunction ->
Lambda.lfunctionApply the given transformation on the function's body
val shallow_map :
(Lambda.lambda -> Lambda.lambda) ->
Lambda.lambda ->
Lambda.lambdaRewrite each immediate sub-term with the function.
val bind :
Lambda.let_kind ->
Ident.t ->
Lambda.lambda ->
Lambda.lambda ->
Lambda.lambdaval bind_with_value_kind :
Lambda.let_kind ->
(Ident.t * Lambda.value_kind) ->
Lambda.lambda ->
Lambda.lambda ->
Lambda.lambdaval negate_integer_comparison :
Lambda.integer_comparison ->
Lambda.integer_comparisonval swap_integer_comparison :
Lambda.integer_comparison ->
Lambda.integer_comparisonval negate_float_comparison :
Lambda.float_comparison ->
Lambda.float_comparisonval swap_float_comparison : Lambda.float_comparison -> Lambda.float_comparisonval default_function_attribute : Lambda.function_attributeval default_stub_attribute : Lambda.function_attributeval function_is_curried : Lambda.lfunction -> boolval find_exact_application :
Lambda.function_kind ->
arity:int ->
Lambda.lambda list ->
Lambda.lambda list optionMaximal number of parameters for a function, or in other words, maximal length of the params list of a lfunction record. This is unlimited (max_int) for bytecode, but limited (currently to 126) for native code.
val tag_of_lazy_tag : Lambda.lazy_block_tag -> intval staticfail : Lambda.lambdaval is_guarded : Lambda.lambda -> boolval patch_guarded : Lambda.lambda -> Lambda.lambda -> Lambda.lambdaval raise_kind : Lambda.raise_kind -> stringval merge_inline_attributes :
Lambda.inline_attribute ->
Lambda.inline_attribute ->
Lambda.inline_attribute option