Update newyork optimizer in compiler book (#549)

## Description

Updates the compiler book to reflect the state of the newyork optimizer
as of resolc `v1.3.0`.
This commit is contained in:
LJ authored and GitHub committed 2026-06-18 16:39:15 +02:00
1 parent 98d818f958
commit 6e0dfdcbb1
30 files changed
+1048 -554

No files matched your search

+23 -3
View File
@@ -35,7 +35,7 @@
const path_to_root = "../";
const default_light_theme = "light";
const default_dark_theme = "navy";
window.path_to_searchindex_js = "../searchindex-a6a49a5a.js";
window.path_to_searchindex_js = "../searchindex-339ac392.js";
</script>
<!-- Start loading toc.js asap -->
<script src="../toc-1290cc30.js"></script>
@@ -183,7 +183,7 @@
<h3 id="llvm-optimization-levels"><a class="header" href="#llvm-optimization-levels">LLVM optimization levels</a></h3>
<pre><code class="language-bash">-O, --optimization &lt;OPTIMIZATION&gt;
</code></pre>
<p><code>resolc</code> exposes the optimization level setting for the LLVM backend. The performance and size of compiled contracts varies wiedly between different optimization levels.</p>
<p><code>resolc</code> exposes the optimization level setting for the LLVM backend. The performance and size of compiled contracts varies widely between different optimization levels. (This is independent of <code>--newyork</code> which selects the IR lowering pipeline.)</p>
<p>Valid levels are the following:</p>
<ul>
<li><code>0</code>: No optimizations are applied.</li>
@@ -194,6 +194,10 @@
<li><code>z</code>: Aggressively optimize for code size.</li>
</ul>
<p>By default, <code>-Oz</code> is applied.</p>
<h3 id="newyork-ir-pipeline"><a class="header" href="#newyork-ir-pipeline">newyork IR pipeline</a></h3>
<pre><code class="language-bash">--newyork
</code></pre>
<p>Enables the <a href="../developer_guide/newyork_optimizer.html">newyork optimizer</a> to reduced compiled contract code size, by routing Yul lowering through the <strong>experimental</strong> newyork IR pipeline instead of the standard Yul-to-LLVM path. Composes with <code>--yul</code>, <code>--combined-json</code>, and the default Solidity mode. In standard JSON mode this flag is rejected; enable the pipeline via the <a href="std_json.html#settingspolkavmnewyork"><code>settings.polkavm.newyork</code></a> input field instead. Off by default.</p>
<h3 id="stack-size"><a class="header" href="#stack-size">Stack size</a></h3>
<pre><code class="language-bash">--stack-size &lt;STACK_SIZE&gt;
</code></pre>
@@ -227,7 +231,7 @@
<h3 id="debug-artifacts"><a class="header" href="#debug-artifacts">Debug artifacts</a></h3>
<pre><code class="language-bash">--debug-output-dir &lt;DEBUG_OUTPUT_DIRECTORY&gt;
</code></pre>
<p>Dump all intermediary compiler artifacts to files in the specified directory. This includes the YUL IR, optimized and unoptimized LLVM IR, the ELF object and the PVM assembly. Useful for debugging and development purposes.</p>
<p>Dump all intermediary compiler artifacts to files in the specified directory. This includes the Yul IR, optimized and unoptimized LLVM IR, the ELF object and the PVM assembly. When the newyork pipeline is active, the <a href="../developer_guide/newyork_optimizer.html#debug-output">newyork IR is additionally dumped</a> (the final IR, a pre-late-pass snapshot, and heap and memory optimization data). Useful for debugging and development purposes.</p>
<h3 id="debug-info"><a class="header" href="#debug-info">Debug info</a></h3>
<pre><code class="language-bash">-g
</code></pre>
@@ -303,6 +307,22 @@
<template id=fa-play><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"/></svg></span></template>
<template id=fa-clock-rotate-left><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75zm181 53c-13.3 0-24 10.7-24 24V256c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65V152c0-13.3-10.7-24-24-24z"/></svg></span></template>
<!-- Livereload script (if served using the cli tool) -->
<script>
const wsProtocol = location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsAddress = wsProtocol + "//" + location.host + "/" + "__livereload";
const socket = new WebSocket(wsAddress);
socket.onmessage = function (event) {
if (event.data === "reload") {
socket.close();
location.reload();
}
};
window.onbeforeunload = function() {
socket.close();
}
</script>
<script>