jon.recoil.org

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:")

type t = let_cont_expr

It 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 Expr_std.S_no_free_names with type t := t
val print : Format.formatter -> t -> unit
val apply_renaming : t -> Flambda2_nominal.Renaming.t -> t

Create 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 -> Continuation_handler.t -> body:expr -> num_free_occurrences_of_cont_in_body: Flambda2_nominal.Num_occurrences.t Flambda2_lattices.Or_unknown.t -> is_applied_with_traps:bool -> expr

Same as create_non_recursive but marks the continuation as a wrapper. Wrapper continuations are not lifted during specialization

Create a definition of a set of possibly-recursive continuations.