Module Flambda.Let_cont_expr
Values of type t represent alpha-equivalence classes of the definitions of continuations:
let_cont name args = handler in body
or using an alternative notation:
body where name args = handler
(In the -drawflambda / -dflambda output, "where" is omitted, in favour of a simple label syntax e.g. "k42:")
- Continuations are second-class.
- Continuations do not capture variables.
- Continuations may be (mutually-)recursive.
type t = Flambda2_terms.Flambda.let_cont_exprIt is an error to mark a continuation that might be recursive as non-recursive. The converse is safe.
Note: any continuation used as an exception handler must be non-recursive by the point it reaches Flambda_to_cmm. (This means that it is permissible to introduce mutual recursion through stubs associated with such continuations, so long as Simplify is run afterwards to inline them out and turn the resulting single Recursive handler into a Non_recursive one.
include Flambda2_terms.Expr_std.S_no_free_names
with type t := Flambda2_terms.Flambda.Let_cont_expr.t
val print :
Stdlib.Format.formatter ->
Flambda2_terms.Flambda.Let_cont_expr.t ->
unitval apply_renaming :
Flambda2_terms.Flambda.Let_cont_expr.t ->
Flambda2_nominal.Renaming.t ->
Flambda2_terms.Flambda.Let_cont_expr.tval create_non_recursive :
Flambda2_identifiers.Continuation.t ->
Flambda2_terms.Flambda.Continuation_handler.t ->
body:Flambda2_terms.Flambda.expr ->
free_names_of_body:
Flambda2_nominal.Name_occurrences.t Flambda2_lattices.Or_unknown.t ->
Flambda2_terms.Flambda.exprCreate a definition of a non-recursive continuation. If the continuation does not occur free in the body, then just the body is returned, without any enclosing Let_cont.
val create_non_recursive' :
cont:Flambda2_identifiers.Continuation.t ->
Flambda2_terms.Flambda.Continuation_handler.t ->
body:Flambda2_terms.Flambda.expr ->
num_free_occurrences_of_cont_in_body:
Flambda2_nominal.Num_occurrences.t Flambda2_lattices.Or_unknown.t ->
is_applied_with_traps:bool ->
Flambda2_terms.Flambda.exprval create_recursive :
invariant_params:Flambda2_bound_identifiers.Bound_parameters.t ->
Flambda2_terms.Flambda.Continuation_handler.t
Flambda2_identifiers.Continuation.Lmap.t ->
body:Flambda2_terms.Flambda.expr ->
Flambda2_terms.Flambda.exprCreate a definition of a set of possibly-recursive continuations.