Closure_conversionval lambda_to_flambda :
backend:(module Backend_intf.S) ->
module_ident:Ident.t ->
size:int ->
Lambda.lambda ->
Flambda.programGeneration of Flambda intermediate language code from Lambda code by performing a form of closure conversion.
Function declarations (which may bind one or more variables identifying functions, possibly with mutual recursion) are transformed to Set_of_closures expressions. Project_closure expressions are then used to select a closure for a particular function from a Set_of_closures expression. The Set_of_closures expressions say nothing about the actual runtime layout of the closures; this is handled when Flambda code is translated to Clambda code.
The following transformations are also performed during closure conversion:
Lambda.Const_block) are converted to applications of the Pmakeblock primitive.Levent debugging event nodes are removed and the information within them attached to function, method and raise calls.f is marked as a stub function *)Pdirapply and Prevapply application primitives are removed and converted to normal Flambda application nodes.The lambda_to_flambda function is not re-entrant.