Files
Nim/compiler/icconfig.html
github-actions[bot] 0686a3c470 Deploy to GitHub pages
2026-07-22 18:32:37 +00:00

230 lines
26 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>icconfig</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<input type="checkbox" id="nav-toggle" hidden>
<label for="nav-toggle" id="nav-burger">&#9776;</label>
<label for="nav-toggle" id="nav-overlay"></label>
<div class="container">
<h1 class="title">icconfig</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple">
<li><a id="indexLink" href="theindex.html">Index</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput" oninput="search()"/>
</div>
<div>
Group by:
<select onchange="groupBy(this.value)">
<option value="section">Section</option>
<option value="type">Type</option>
</select>
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#10" id="60">Consts</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#IcConfigVersion" title="IcConfigVersion = &quot;2&quot;">IcConfigVersion</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">applyIcConfig
<li><a class="reference" href="#applyIcConfig%2CConfigRef%2Cstring" title="applyIcConfig(conf: ConfigRef; infile: string): bool">applyIcConfig(conf: ConfigRef; infile: string): bool</a></li>
</ul>
<ul class="simple nested-toc-section">ensureIcConfig
<li><a class="reference" href="#ensureIcConfig%2CConfigRef" title="ensureIcConfig(conf: ConfigRef)">ensureIcConfig(conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">produceIcConfig
<li><a class="reference" href="#produceIcConfig%2CConfigRef" title="produceIcConfig(conf: ConfigRef)">produceIcConfig(conf: ConfigRef)</a></li>
</ul>
<ul class="simple nested-toc-section">sourcesChanged
<li><a class="reference" href="#sourcesChanged%2Cstring" title="sourcesChanged(configFile: string): bool">sourcesChanged(configFile: string): bool</a></li>
</ul>
<ul class="simple nested-toc-section">writeIcConfig
<li><a class="reference" href="#writeIcConfig%2CConfigRef%2Cstring" title="writeIcConfig(conf: ConfigRef; outfile: string)">writeIcConfig(conf: ConfigRef; outfile: string)</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/icconfig.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/icconfig.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<p class="module-desc"><p>Precompiled config for the incremental compiler (<tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">ic</span></span></tt>).</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">ic</span></span></tt> builds the program by spawning one <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">m</span></span></tt> child per module (or strongly-connected import group) plus a final <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">nifc</span></span></tt>. Each child is a full Nim process, so each would normally re-read the whole <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span><span class="Operator">.</span><span class="Identifier">cfg</span></span></tt> chain <em>and</em> re-run <tt class="docutils literal"><span class="pre"><span class="Identifier">config</span><span class="Operator">.</span><span class="Identifier">nims</span></span></tt> through the VM — work that is identical for every child and, because of the VM run, far from free. With ~85 modules in the compiler itself that config work is paid ~85 times during <tt class="docutils literal"><span class="pre"><span class="Identifier">koch</span> <span class="Identifier">bootic</span></span></tt>.</p>
<p>The fix mirrors Nimony's <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">cfg</span><span class="Operator">.</span><span class="Identifier">nif</span></span></tt>: the driver parses config once, records the net effect, and the children replay it. Every config-file switch funnels through <tt class="docutils literal"><span class="pre"><span class="Identifier">processSwitch</span><span class="Punctuation">(</span><span class="Operator">...</span><span class="Punctuation">,</span> <span class="Identifier">passPP</span><span class="Punctuation">,</span> <span class="Operator">...</span><span class="Punctuation">)</span></span></tt> (<tt class="docutils literal"><span class="pre"><span class="Identifier">nimconf</span><span class="Operator">.</span><span class="Identifier">parseAssignment</span></span></tt> and the <tt class="docutils literal"><span class="pre"><span class="Identifier">switch</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> callback in <tt class="docutils literal"><span class="pre"><span class="Identifier">scriptconfig</span></span></tt>), so the recorded sequence of those switches, replayed in order, reproduces an identical <tt class="docutils literal"><span class="pre"><span class="Identifier">ConfigRef</span></span></tt> without any file read or VM run. The one config side effect that does not go through <tt class="docutils literal"><span class="pre"><span class="Identifier">processSwitch</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">cppDefine</span></span></tt> (it mutates <tt class="docutils literal"><span class="pre"><span class="Identifier">conf</span><span class="Operator">.</span><span class="Identifier">cppDefines</span></span></tt> directly), so the resolved set is serialised alongside.</p>
<p>Path-search switches are deliberately excluded from the recording (see <tt class="docutils literal"><span class="pre"><span class="Identifier">commands</span><span class="Operator">.</span><span class="Identifier">processSwitch</span></span></tt>): their resolved result already lives in <tt class="docutils literal"><span class="pre"><span class="Identifier">conf</span><span class="Operator">.</span><span class="Identifier">searchPaths</span></span></tt>, which the driver forwards to every child as absolute <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">path</span></span></tt> arguments; replaying their raw, config-dir-relative arguments here would misresolve.</p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="options.html">options</a>, <a class="reference external" href="commands.html">commands</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="msgs.html">msgs</a>
</dl>
</div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="IcConfigVersion">
<dt><pre><a href="#IcConfigVersion"><span class="Identifier">IcConfigVersion</span></a> <span class="Other">=</span> <span class="StringLit">&quot;2&quot;</span></pre></dt>
<dd>
Artifact format version. Bump on any layout change here so a child built by an older compiler rejects a stale artifact and falls back to normal config loading instead of replaying a format it cannot parse.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/icconfig.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/icconfig.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="applyIcConfig-procs-all">
<div id="applyIcConfig,ConfigRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#applyIcConfig%2CConfigRef%2Cstring"><span class="Identifier">applyIcConfig</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">infile</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">,</span> <span class="Identifier">EOFError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span>
<span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteEnvEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Replay the precompiled config into <tt class="docutils literal"><span class="pre"><span class="Identifier">conf</span></span></tt>. Returns false (and applies nothing meaningful) when the artifact is missing or written by a compiler with an incompatible format version, so the caller can fall back to reading the config files normally.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/icconfig.nim#L91" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/icconfig.nim#L91" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="ensureIcConfig-procs-all">
<div id="ensureIcConfig,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#ensureIcConfig%2CConfigRef"><span class="Identifier">ensureIcConfig</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span>
<span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
<span class="Identifier">WriteDirEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ExecIOEffect</span><span class="Other">,</span>
<span class="Identifier">TimeEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Driver-side (<tt class="docutils literal"><span class="pre"><span class="Identifier">cmdIc</span></span></tt>). Make sure an up-to-date precompiled config exists, (re)producing it in a <em>separate</em> process when missing or stale, then point <tt class="docutils literal"><span class="pre"><span class="Identifier">conf</span><span class="Operator">.</span><span class="Identifier">icPreparsedConfig</span></span></tt> at it so the driver replays the very same config its <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">m</span></span></tt>/<tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">nifc</span></span></tt> children will — perfect speed (config parsed at most once, skipped entirely when nothing changed) and consistency (one producer, every process replays its output). The artifact lives in the nimcache derived from the command line (pre-config-parse), which is the one the children are told; a <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">nimcache</span><span class="Punctuation">:</span></span></tt> set inside <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span><span class="Operator">.</span><span class="Identifier">cfg</span></span></tt> is recovered from the artifact itself.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/icconfig.nim#L238" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/icconfig.nim#L238" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="produceIcConfig-procs-all">
<div id="produceIcConfig,ConfigRef">
<dt><pre><span class="Keyword">proc</span> <a href="#produceIcConfig%2CConfigRef"><span class="Identifier">produceIcConfig</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span>
<span class="Identifier">KeyError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">ERecoverableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">ReadDirEffect</span><span class="Other">,</span>
<span class="Identifier">WriteIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">WriteDirEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
The <tt class="docutils literal"><span class="pre"><span class="Identifier">cmdIcConfig</span></span></tt> command. By the time it runs, the normal pipeline has already fully parsed the <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span><span class="Operator">.</span><span class="Identifier">cfg</span></span></tt> chain and run <tt class="docutils literal"><span class="pre"><span class="Identifier">config</span><span class="Operator">.</span><span class="Identifier">nims</span></span></tt>, so the resolved config is sitting in <tt class="docutils literal"><span class="pre"><span class="Identifier">conf</span></span></tt>; just serialise it to <tt class="docutils literal"><span class="pre"><span class="Operator">--</span><span class="Identifier">o</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/icconfig.nim#L227" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/icconfig.nim#L227" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="sourcesChanged-procs-all">
<div id="sourcesChanged,string">
<dt><pre><span class="Keyword">proc</span> <a href="#sourcesChanged%2Cstring"><span class="Identifier">sourcesChanged</span></a><span class="Other">(</span><span class="Identifier">configFile</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
True when the precompiled config at <tt class="docutils literal"><span class="pre"><span class="Identifier">configFile</span></span></tt> is missing, malformed, written by an incompatible version, or any recorded config <em>source</em> file is newer than it (or has vanished) — i.e. the artifact must be regenerated. Mirrors nifler's <tt class="docutils literal"><span class="pre"><span class="Identifier">sourcesChanged</span></span></tt>: the source list lives inside the artifact so this needs no out-of-band knowledge of which <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span><span class="Operator">.</span><span class="Identifier">cfg</span></span></tt>s were read.
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/icconfig.nim#L184" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/icconfig.nim#L184" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="writeIcConfig-procs-all">
<div id="writeIcConfig,ConfigRef,string">
<dt><pre><span class="Keyword">proc</span> <a href="#writeIcConfig%2CConfigRef%2Cstring"><span class="Identifier">writeIcConfig</span></a><span class="Other">(</span><span class="Identifier">conf</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">outfile</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Serialise the resolved config (the config-file switches recorded during <tt class="docutils literal"><span class="pre"><span class="Identifier">loadConfigs</span></span></tt>, the resolved <tt class="docutils literal"><span class="pre"><span class="Identifier">cppDefines</span></span></tt>/<tt class="docutils literal"><span class="pre"><span class="Identifier">searchPaths</span></span></tt>, the nimcache dir, and the list of config <em>source</em> files for staleness detection) into <tt class="docutils literal"><span class="pre"><span class="Identifier">outfile</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">OnlyIfChanged</span></span></tt>: when the content is byte-identical to what is already on disk the file is left untouched so its mtime does not advance — otherwise every <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">ic</span></span></tt> run would re-fire the whole nifmake graph (see <tt class="docutils literal"><span class="pre"><span class="Identifier">nifler</span></span></tt>'s <tt class="docutils literal"><span class="pre"><span class="Identifier">produceConfig</span></span></tt>, whose model this mirrors).
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/icconfig.nim#L44" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/icconfig.nim#L44" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2026-07-22 18:32:36 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>