mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-16 15:56:21 -05:00
11 lines
No EOL
3.1 KiB
HTML
11 lines
No EOL
3.1 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Unbox_specialised_args (ocaml.Unbox_specialised_args)</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> » Unbox_specialised_args</nav><header class="odoc-preamble"><h1>Module <code><span>Unbox_specialised_args</span></code></h1><p>When approximations of specialised arguments indicate that they are closures or blocks, add more specialised arguments corresponding to the projections from such blocks (with definitions of such projections lifted out), such that the original specialised arguments may later be eliminated.</p><p>This in particular enables elimination of closure allocations in examples such as:</p><p>let rec map f = function | -> | a::l -> let r = f a in r :: map f l</p><p>let g x = map (fun y -> x + y) <code>1; 2; 3; 4</code></p><p>Here, the specialised version of <code>map</code> initially has a specialised argument <code>f</code>; and upon inlining there will be a projection of <code>x</code> from the closure of <code>f</code>. This pass adds a new specialised argument to carry that projection, at which point the closure of <code>f</code> is redundant.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-rewrite_set_of_closures"><a href="#val-rewrite_set_of_closures" class="anchor"></a><code><span><span class="keyword">val</span> rewrite_set_of_closures :
|
||
<span>env:<a href="../Inline_and_simplify_aux/Env/index.html#type-t">Inline_and_simplify_aux.Env.t</a> <span class="arrow">-></span></span>
|
||
<span>duplicate_function:
|
||
<span>(<span>env:<a href="../Inline_and_simplify_aux/Env/index.html#type-t">Inline_and_simplify_aux.Env.t</a> <span class="arrow">-></span></span>
|
||
<span>set_of_closures:<a href="../Flambda/index.html#type-set_of_closures">Flambda.set_of_closures</a> <span class="arrow">-></span></span>
|
||
<span>fun_var:<a href="../Variable/index.html#type-t">Variable.t</a> <span class="arrow">-></span></span>
|
||
<span>new_fun_var:<a href="../Variable/index.html#type-t">Variable.t</a> <span class="arrow">-></span></span>
|
||
<a href="../Flambda/index.html#type-function_declaration">Flambda.function_declaration</a> * <span><a href="../Flambda/index.html#type-specialised_to">Flambda.specialised_to</a> <a href="../Variable/Map/index.html#type-t">Variable.Map.t</a></span>)</span> <span class="arrow">-></span></span>
|
||
<span>set_of_closures:<a href="../Flambda/index.html#type-set_of_closures">Flambda.set_of_closures</a> <span class="arrow">-></span></span>
|
||
<span><span>(<a href="../Flambda/index.html#type-expr">Flambda.expr</a> * <a href="../Inlining_cost/Benefit/index.html#type-t">Inlining_cost.Benefit.t</a>)</span> option</span></span></code></div></div></div></body></html> |