mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-16 23:56:49 -05:00
7 lines
No EOL
3 KiB
HTML
7 lines
No EOL
3 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Closure_conversion (ocaml.Closure_conversion)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../index.html">ocaml</a> » Closure_conversion</nav><header class="odoc-preamble"><h1>Module <code><span>Closure_conversion</span></code></h1></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-lambda_to_flambda"><a href="#val-lambda_to_flambda" class="anchor"></a><code><span><span class="keyword">val</span> lambda_to_flambda :
|
||
<span>backend:<span>(<span class="keyword">module</span> <a href="../Backend_intf/module-type-S/index.html">Backend_intf.S</a>)</span> <span class="arrow">-></span></span>
|
||
<span>module_ident:<a href="../Ident/index.html#type-t">Ident.t</a> <span class="arrow">-></span></span>
|
||
<span>size:int <span class="arrow">-></span></span>
|
||
<span><a href="../Lambda/index.html#type-lambda">Lambda.lambda</a> <span class="arrow">-></span></span>
|
||
<a href="../Flambda/index.html#type-program">Flambda.program</a></span></code></div><div class="spec-doc"><p>Generation of <code>Flambda</code> intermediate language code from <code>Lambda</code> code by performing a form of closure conversion.</p><p>Function declarations (which may bind one or more variables identifying functions, possibly with mutual recursion) are transformed to <code>Set_of_closures</code> expressions. <code>Project_closure</code> expressions are then used to select a closure for a particular function from a <code>Set_of_closures</code> expression. The <code>Set_of_closures</code> expressions say nothing about the actual runtime layout of the closures; this is handled when <code>Flambda</code> code is translated to <code>Clambda</code> code.</p><p>The following transformations are also performed during closure conversion:</p><ul><li>Constant blocks (by which is meant things wrapped in <code>Lambda.Const_block</code>) are converted to applications of the <code>Pmakeblock</code> primitive.</li><li><code>Levent</code> debugging event nodes are removed and the information within them attached to function, method and <code>raise</code> calls.</li><li>Tuplified functions are converted to curried functions and a stub function emitted to call the curried version. For example: let rec f (x, y) = f (x + 1, y + 1) is transformed to: let rec internal_f x y = f (x + 1,y + 1) and f (x, y) = internal_f x y (* <code>f</code> is marked as a stub function *)</li><li>The <code>Pdirapply</code> and <code>Prevapply</code> application primitives are removed and converted to normal <code>Flambda</code> application nodes.</li></ul><p>The <code>lambda_to_flambda</code> function is not re-entrant.</p></div></div></div></body></html> |