mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-31 20:49:06 +00:00
876 lines
110 KiB
HTML
876 lines
110 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>ast2nif</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">☰</label>
|
|
<label for="nav-toggle" id="nav-overlay"></label>
|
|
<div class="container">
|
|
<h1 class="title">ast2nif</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div class="theme-select-wrapper">
|
|
<label for="theme-select">Theme: </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="#7" id="57">Types</a></summary>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#DecodeContext" title="DecodeContext = object">DecodeContext</a></li>
|
|
<li><a class="reference" href="#LoadFlag" title="LoadFlag = enum
|
|
LoadFullAst, AlwaysLoadInterface">LoadFlag</a></li>
|
|
<li><a class="reference" href="#ModuleSuffix" title="ModuleSuffix = distinct string">ModuleSuffix</a></li>
|
|
<li><a class="reference" href="#ParsedSymName" title="ParsedSymName = object
|
|
name*: string
|
|
module*: string
|
|
count*: int">ParsedSymName</a></li>
|
|
<li><a class="reference" href="#PrecompiledModule" title="PrecompiledModule = object
|
|
topLevel*: PNode
|
|
deps*: seq[ModuleSuffix]
|
|
logOps*: seq[LogEntry]
|
|
module*: PSym
|
|
reexportedModules*: seq[(string, string)]
|
|
genericOffers*: seq[tuple[generic, inst: PSym, concreteTypes: seq[PType],
|
|
genericParamsCount: int]] ## generic instances this module created; modulegraphs.nim rebuilds
|
|
## `procInstCache` from them so a consumer reuses the instance instead of
|
|
## re-instantiating it in its own (operator-blind) module scope.
|
|
typeOffers*: seq[tuple[generic: PSym, inst: PType]] ## generic TYPE instances this module created; modulegraphs.nim rebuilds
|
|
## `typeInstCache` from them so a consumer reuses the baked instance
|
|
## (e.g. a `mixin`/`compiles()`-dependent array bound) instead of
|
|
## re-instantiating it with a different bound in its own scope.
|
|
includes*: seq[string]">PrecompiledModule</a></li>
|
|
|
|
</ul>
|
|
</details>
|
|
</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="#BackendLocalMarker" title="BackendLocalMarker = "@bk"">BackendLocalMarker</a></li>
|
|
<li><a class="reference" href="#SysModuleSuffix" title="SysModuleSuffix = "@sys"">SysModuleSuffix</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">createDecodeContext
|
|
<li><a class="reference" href="#createDecodeContext%2CConfigRef%2CIdentCache" title="createDecodeContext(config: ConfigRef; cache: IdentCache): DecodeContext">createDecodeContext(config: ConfigRef; cache: IdentCache): DecodeContext</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">firstSon
|
|
<li><a class="reference" href="#firstSon%2CCursor" title="firstSon(n: Cursor): Cursor">firstSon(n: Cursor): Cursor</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">getMainModuleSuffix
|
|
<li><a class="reference" href="#getMainModuleSuffix%2CDecodeContext" title="getMainModuleSuffix(c: DecodeContext): string">getMainModuleSuffix(c: DecodeContext): string</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">globalName
|
|
<li><a class="reference" href="#globalName%2CPSym%2CConfigRef" title="globalName(sym: PSym; config: ConfigRef): string">globalName(sym: PSym; config: ConfigRef): string</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">icNifTypeName
|
|
<li><a class="reference" href="#icNifTypeName%2CPType%2CConfigRef" title="icNifTypeName(typ: PType; config: ConfigRef): string">icNifTypeName(typ: PType; config: ConfigRef): string</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">isStub
|
|
<li><a class="reference" href="#isStub%2CPSym" title="isStub(s: PSym): bool">isStub(s: PSym): bool</a></li>
|
|
<li><a class="reference" href="#isStub%2CPType" title="isStub(t: PType): bool">isStub(t: PType): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">loadedModuleTypes
|
|
<li><a class="reference" href="#loadedModuleTypes%2CDecodeContext%2CFileIndex" title="loadedModuleTypes(c: var DecodeContext; module: FileIndex): seq[PType]">loadedModuleTypes(c: var DecodeContext; module: FileIndex): seq[PType]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">loadNifModule
|
|
<li><a class="reference" href="#loadNifModule%2CDecodeContext%2CFileIndex%2CTStrTable%2CTStrTable%2Cset%5BLoadFlag%5D" title="loadNifModule(c: var DecodeContext; f: FileIndex;
|
|
interf, interfHidden: var TStrTable; flags: set[LoadFlag] = {}): PrecompiledModule">loadNifModule(c: var DecodeContext; f: FileIndex;
|
|
interf, interfHidden: var TStrTable; flags: set[LoadFlag] = {}): PrecompiledModule</a></li>
|
|
<li><a class="reference" href="#loadNifModule%2CDecodeContext%2CModuleSuffix%2CTStrTable%2CTStrTable%2Cset%5BLoadFlag%5D" title="loadNifModule(c: var DecodeContext; suffix: ModuleSuffix;
|
|
interf, interfHidden: var TStrTable; flags: set[LoadFlag] = {}): PrecompiledModule">loadNifModule(c: var DecodeContext; suffix: ModuleSuffix;
|
|
interf, interfHidden: var TStrTable; flags: set[LoadFlag] = {}): PrecompiledModule</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">loadSym
|
|
<li><a class="reference" href="#loadSym%2CDecodeContext%2CPSym" title="loadSym(c: var DecodeContext; s: PSym)">loadSym(c: var DecodeContext; s: PSym)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">loadType
|
|
<li><a class="reference" href="#loadType%2CDecodeContext%2CPType" title="loadType(c: var DecodeContext; t: PType)">loadType(c: var DecodeContext; t: PType)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">materializeLazyBody
|
|
<li><a class="reference" href="#materializeLazyBody%2CDecodeContext%2CPNode" title="materializeLazyBody(c: var DecodeContext; node: PNode)">materializeLazyBody(c: var DecodeContext; node: PNode)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">moduleSymbolStubs
|
|
<li><a class="reference" href="#moduleSymbolStubs%2CDecodeContext%2CFileIndex" title="moduleSymbolStubs(c: var DecodeContext; module: FileIndex): seq[PSym]">moduleSymbolStubs(c: var DecodeContext; module: FileIndex): seq[PSym]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">nextBackendSymItem
|
|
<li><a class="reference" href="#nextBackendSymItem%2CDecodeContext%2Cint32" title="nextBackendSymItem(c: var DecodeContext; module: int32): int32">nextBackendSymItem(c: var DecodeContext; module: int32): int32</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">nextBackendTypeItem
|
|
<li><a class="reference" href="#nextBackendTypeItem%2CDecodeContext%2Cint32" title="nextBackendTypeItem(c: var DecodeContext; module: int32): int32">nextBackendTypeItem(c: var DecodeContext; module: int32): int32</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">nifModuleHasIncludes
|
|
<li><a class="reference" href="#nifModuleHasIncludes%2CConfigRef%2CFileIndex" title="nifModuleHasIncludes(config: ConfigRef; fileIdx: FileIndex): bool">nifModuleHasIncludes(config: ConfigRef; fileIdx: FileIndex): bool</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">parseSymName
|
|
<li><a class="reference" href="#parseSymName%2Cstring" title="parseSymName(s: string): ParsedSymName">parseSymName(s: string): ParsedSymName</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">registerNifAstTags
|
|
<li><a class="reference" href="#registerNifAstTags" title="registerNifAstTags()">registerNifAstTags()</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">resolveHookSym
|
|
<li><a class="reference" href="#resolveHookSym%2CDecodeContext%2Cstring" title="resolveHookSym(c: var DecodeContext; name: string): PSym">resolveHookSym(c: var DecodeContext; name: string): PSym</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">scanIncludeGraph
|
|
<li><a class="reference" href="#scanIncludeGraph%2CConfigRef" title="scanIncludeGraph(config: ConfigRef): seq[
|
|
tuple[includer: string, includes: seq[string]]]">scanIncludeGraph(config: ConfigRef): seq[
|
|
tuple[includer: string, includes: seq[string]]]</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">sealLoadedRoutines
|
|
<li><a class="reference" href="#sealLoadedRoutines%2CDecodeContext" title="sealLoadedRoutines(c: var DecodeContext)">sealLoadedRoutines(c: var DecodeContext)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">setMainModule
|
|
<li><a class="reference" href="#setMainModule%2CDecodeContext%2CFileIndex" title="setMainModule(c: var DecodeContext; fileIdx: FileIndex)">setMainModule(c: var DecodeContext; fileIdx: FileIndex)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toClassSymId
|
|
<li><a class="reference" href="#toClassSymId%2CConfigRef%2CItemId" title="toClassSymId(config: ConfigRef; typeId: ItemId): nifstreams.SymId">toClassSymId(config: ConfigRef; typeId: ItemId): nifstreams.SymId</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toConverterIndexEntry
|
|
<li><a class="reference" href="#toConverterIndexEntry%2CConfigRef%2CPSym" title="toConverterIndexEntry(config: ConfigRef; converterSym: PSym): (nifstreams.SymId,
|
|
nifstreams.SymId)">toConverterIndexEntry(config: ConfigRef; converterSym: PSym): (nifstreams.SymId,
|
|
nifstreams.SymId)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toHookIndexEntry
|
|
<li><a class="reference" href="#toHookIndexEntry%2CConfigRef%2CItemId%2CPSym" title="toHookIndexEntry(config: ConfigRef; typeId: ItemId; hookSym: PSym): HookIndexEntry">toHookIndexEntry(config: ConfigRef; typeId: ItemId; hookSym: PSym): HookIndexEntry</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toMethodIndexEntry
|
|
<li><a class="reference" href="#toMethodIndexEntry%2CConfigRef%2CPSym%2Cstring" title="toMethodIndexEntry(config: ConfigRef; methodSym: PSym; signature: string): (
|
|
nifstreams.SymId, nifstreams.StrId)">toMethodIndexEntry(config: ConfigRef; methodSym: PSym; signature: string): (
|
|
nifstreams.SymId, nifstreams.StrId)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">toNifFilename
|
|
<li><a class="reference" href="#toNifFilename%2CConfigRef%2CFileIndex" title="toNifFilename(conf: ConfigRef; f: FileIndex): string">toNifFilename(conf: ConfigRef; f: FileIndex): string</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">tryResolveCompilerProc
|
|
<li><a class="reference" href="#tryResolveCompilerProc%2CDecodeContext%2Cstring%2CFileIndex" title="tryResolveCompilerProc(c: var DecodeContext; name: string;
|
|
moduleFileIdx: FileIndex): PSym">tryResolveCompilerProc(c: var DecodeContext; name: string;
|
|
moduleFileIdx: FileIndex): PSym</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">writeLoweredModule
|
|
<li><a class="reference" href="#writeLoweredModule%2CDecodeContext%2CConfigRef%2CPrecompiledModule%2CopenArray%5BLogEntry%5D%2Cstring" title="writeLoweredModule(c: var DecodeContext; config: ConfigRef;
|
|
precomp: PrecompiledModule; hooks: openArray[LogEntry];
|
|
outfile: string)">writeLoweredModule(c: var DecodeContext; config: ConfigRef;
|
|
precomp: PrecompiledModule; hooks: openArray[LogEntry];
|
|
outfile: string)</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">writeNifModule
|
|
<li><a class="reference" href="#writeNifModule%2CConfigRef%2Cint32%2CPNode%2Cseq%5BLogEntry%5D%2Cseq%5BPNode%5D%2Cseq%5Bint%5D%2Cseq%5B%5D%2Cseq%5Btuple%5BPSym%2CPSym%2Cseq%5BPType%5D%2Cint%5D%5D%2Cseq%5Btuple%5BPSym%2CPType%5D%5D%2Cseq%5BFileIndex%5D%2Cint32%2Cseq%5B%5D" title="writeNifModule(config: ConfigRef; thisModule: int32; n: PNode;
|
|
opsLog: seq[LogEntry]; replayActions: seq[PNode] = @[];
|
|
implDeps: seq[int] = @[];
|
|
reexportedModules: seq[(string, string)] = @[]; genericOffers: seq[tuple[
|
|
generic, inst: PSym, concreteTypes: seq[PType], genericParamsCount: int]] = @[];
|
|
typeOffers: seq[tuple[generic: PSym, inst: PType]] = @[];
|
|
resolvedImportDeps: seq[FileIndex] = @[];
|
|
firstUnusedId: int32 = 0;
|
|
expansions: seq[(PSym, TLineInfo)] = @[])">writeNifModule(config: ConfigRef; thisModule: int32; n: PNode;
|
|
opsLog: seq[LogEntry]; replayActions: seq[PNode] = @[];
|
|
implDeps: seq[int] = @[];
|
|
reexportedModules: seq[(string, string)] = @[]; genericOffers: seq[tuple[
|
|
generic, inst: PSym, concreteTypes: seq[PType], genericParamsCount: int]] = @[];
|
|
typeOffers: seq[tuple[generic: PSym, inst: PType]] = @[];
|
|
resolvedImportDeps: seq[FileIndex] = @[];
|
|
firstUnusedId: int32 = 0;
|
|
expansions: seq[(PSym, TLineInfo)] = @[])</a></li>
|
|
|
|
</ul>
|
|
<ul class="simple nested-toc-section">writeSemDeps
|
|
<li><a class="reference" href="#writeSemDeps%2CConfigRef%2Cint32%2Cseq%5Bstring%5D" title="writeSemDeps(config: ConfigRef; thisModule: int32; importPaths: seq[string])">writeSemDeps(config: ConfigRef; thisModule: int32; importPaths: seq[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/ast2nif.nim#L1" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
<div id="tocRoot"></div>
|
|
|
|
<p class="module-desc">AST to NIF bridge.</p>
|
|
<div class="section" id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="astdef.html">astdef</a>, <a class="reference external" href="idents.html">idents</a>, <a class="reference external" href="msgs.html">msgs</a>, <a class="reference external" href="options.html">options</a>, <a class="reference external" href="lineinfos.html">lineinfos</a>, <a class="reference external" href="pathutils.html">pathutils</a>, <a class="reference external" href="icmodnames.html">icmodnames</a>, <a class="reference external" href="typekeys.html">typekeys</a>, <a class="reference external" href="icnifcore.html">icnifcore</a>, <a class="reference external" href="ic/enum2nif.html">ic/enum2nif</a>
|
|
</dl>
|
|
</div>
|
|
<div class="section" id="7">
|
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
|
<dl class="item">
|
|
<div id="DecodeContext">
|
|
<dt><pre><a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1901" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1901" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="LoadFlag">
|
|
<dt><pre><a href="#LoadFlag"><span class="Identifier">LoadFlag</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
|
|
<span class="Identifier">LoadFullAst</span><span class="Other">,</span> <span class="Identifier">AlwaysLoadInterface</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2030" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2030" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="ModuleSuffix">
|
|
<dt><pre><a href="#ModuleSuffix"><span class="Identifier">ModuleSuffix</span></a> <span class="Other">=</span> <span class="Keyword">distinct</span> <span class="Identifier">string</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3095" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3095" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="ParsedSymName">
|
|
<dt><pre><a href="#ParsedSymName"><span class="Identifier">ParsedSymName</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">name</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
|
|
<span class="Identifier">module</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">string</span>
|
|
<span class="Identifier">count</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L352" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L352" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="PrecompiledModule">
|
|
<dt><pre><a href="#PrecompiledModule"><span class="Identifier">PrecompiledModule</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
|
|
<span class="Identifier">topLevel</span><span class="Operator">*</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a>
|
|
<span class="Identifier">deps</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="#ModuleSuffix"><span class="Identifier">ModuleSuffix</span></a><span class="Other">]</span>
|
|
<span class="Identifier">logOps</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#LogEntry"><span class="Identifier">LogEntry</span></a><span class="Other">]</span>
|
|
<span class="Identifier">module</span><span class="Operator">*</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a>
|
|
<span class="Identifier">reexportedModules</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Other">(</span><span class="Identifier">string</span><span class="Other">,</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">]</span>
|
|
<span class="Identifier">genericOffers</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">generic</span><span class="Other">,</span> <span class="Identifier">inst</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">,</span> <span class="Identifier">concreteTypes</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">genericParamsCount</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">]</span><span class="Other">]</span> <span class="Comment">## generic instances this module created; modulegraphs.nim rebuilds</span>
|
|
<span class="Comment">## `procInstCache` from them so a consumer reuses the instance instead of</span>
|
|
<span class="Comment">## re-instantiating it in its own (operator-blind) module scope.</span>
|
|
<span class="Identifier">typeOffers</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">generic</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">,</span> <span class="Identifier">inst</span><span class="Other">:</span> <a href="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">]</span><span class="Other">]</span> <span class="Comment">## generic TYPE instances this module created; modulegraphs.nim rebuilds</span>
|
|
<span class="Comment">## `typeInstCache` from them so a consumer reuses the baked instance</span>
|
|
<span class="Comment">## (e.g. a `mixin`/`compiles()`-dependent array bound) instead of</span>
|
|
<span class="Comment">## re-instantiating it with a different bound in its own scope.</span>
|
|
<span class="Identifier">includes</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3096" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3096" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl>
|
|
</div>
|
|
<div class="section" id="10">
|
|
<h1><a class="toc-backref" href="#10">Consts</a></h1>
|
|
<dl class="item">
|
|
<div id="BackendLocalMarker">
|
|
<dt><pre><a href="#BackendLocalMarker"><span class="Identifier">BackendLocalMarker</span></a> <span class="Other">=</span> <span class="StringLit">"@bk"</span></pre></dt>
|
|
<dd>
|
|
|
|
Suffix marker for a PROCESS-LOCAL backend-minted entity (a closure <tt class="docutils literal"><span class="pre"><span class="Punctuation">:</span><span class="Identifier">env</span></span></tt> type/obj/field/hidden-param minted while the VM compiles a routine body to run a macro). Such entities have no stable cross-process identity, so each module that references one emits its OWN module-local def named <tt class="docutils literal"><span class="pre"><span class="Identifier">…</span><span class="Operator"><</span><span class="Identifier">thisModuleSuffix</span><span class="Operator">>@</span><span class="Identifier">bk</span></span></tt> and the loader homes it to the reading module with a <tt class="docutils literal"><span class="pre"><span class="Identifier">backendItemId</span></span></tt> (disjoint from real ids). See transf.transformBody. Reserved module-suffix sentinel for module-less magic singleton types — the <tt class="docutils literal"><span class="pre"><span class="Keyword">nil</span></span></tt> type is created via <tt class="docutils literal"><span class="pre"><span class="Identifier">newSysType</span></span></tt> with the graph idgen, whose <tt class="docutils literal"><span class="pre"><span class="Identifier">module</span></span></tt> can be <tt class="docutils literal"><span class="pre"><span class="Operator">-</span><span class="DecNumber">1</span></span></tt> (e.g. during VM const-eval before a real module is current), so its <tt class="docutils literal"><span class="pre"><span class="Identifier">uniqueId</span><span class="Operator">.</span><span class="Identifier">module</span></span></tt> is unresolvable. Such a type has no fields and an identity that is fully captured by its kind, so we serialize it with this sentinel and reconstruct it on load (see <tt class="docutils literal"><span class="pre"><span class="Identifier">createTypeStub</span></span></tt>) without ever touching a <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">nif</span></span></tt> file. A real <tt class="docutils literal"><span class="pre"><span class="Identifier">moduleSuffix</span></span></tt> never starts with '@'.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L39" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L39" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="SysModuleSuffix">
|
|
<dt><pre><a href="#SysModuleSuffix"><span class="Identifier">SysModuleSuffix</span></a> <span class="Other">=</span> <span class="StringLit">"@sys"</span></pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L38" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L38" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</dl>
|
|
</div>
|
|
<div class="section" id="12">
|
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
|
<dl class="item">
|
|
<div id="createDecodeContext-procs-all">
|
|
<div id="createDecodeContext,ConfigRef,IdentCache">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#createDecodeContext%2CConfigRef%2CIdentCache"><span class="Identifier">createDecodeContext</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">cache</span><span class="Other">:</span> <a href="idents.html#IdentCache"><span class="Identifier">IdentCache</span></a><span class="Other">)</span><span class="Other">:</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a> {.
|
|
<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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Supposed to be a global variable
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1919" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1919" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="firstSon-procs-all">
|
|
<div id="firstSon,Cursor">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#firstSon%2CCursor"><span class="Identifier">firstSon</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">Cursor</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Cursor</span> {.<span class="Identifier">inline</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Non-consuming peek at the first child of a TagLit. The <tt class="docutils literal"><span class="pre"><span class="Identifier">inc</span></span></tt> is on a copy, so it never advances the caller's cursor.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1859" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1859" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="getMainModuleSuffix-procs-all">
|
|
<div id="getMainModuleSuffix,DecodeContext">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#getMainModuleSuffix%2CDecodeContext"><span class="Identifier">getMainModuleSuffix</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</span> {.<span class="Identifier">inline</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="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2006" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2006" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="globalName-procs-all">
|
|
<div id="globalName,PSym,ConfigRef">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#globalName%2CPSym%2CConfigRef"><span class="Identifier">globalName</span></a><span class="Other">(</span><span class="Identifier">sym</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L336" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L336" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="icNifTypeName-procs-all">
|
|
<div id="icNifTypeName,PType,ConfigRef">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#icNifTypeName%2CPType%2CConfigRef"><span class="Identifier">icNifTypeName</span></a><span class="Other">(</span><span class="Identifier">typ</span><span class="Other">:</span> <a href="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</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="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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 serialized NIF name of a type, recorded next to RTTI data definitions in the cnif artifact so a later run can re-demand the typeinfo when a reused TU still references it (the def-retention check). Backend-minted types have no NIF name.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L68" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L68" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="isStub-procs-all">
|
|
<div id="isStub,PSym">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#isStub%2CPSym"><span class="Identifier">isStub</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2415" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2415" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="isStub,PType">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#isStub%2CPType"><span class="Identifier">isStub</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">inline</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2414" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2414" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="loadedModuleTypes-procs-all">
|
|
<div id="loadedModuleTypes,DecodeContext,FileIndex">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#loadedModuleTypes%2CDecodeContext%2CFileIndex"><span class="Identifier">loadedModuleTypes</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#PType"><span class="Identifier">PType</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">KeyError</span><span class="Other">,</span> <span class="Identifier">OSError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
Stubs for every TYPE this module owns — but, unlike before, WITHOUT force- loading them. <tt class="docutils literal"><span class="pre"><span class="Identifier">writeLoweredModule</span></span></tt> emits a real def into the <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">bif</span></span></tt> only for the ones already <tt class="docutils literal"><span class="pre"><span class="Identifier">Complete</span></span></tt> (= the lower stage actually loaded, hence possibly MUTATED — lambda-lifting flips a proc type to <tt class="docutils literal"><span class="pre"><span class="Identifier">ccClosure</span></span></tt> and grows env types with captured fields). Every untouched type stays <tt class="docutils literal"><span class="pre"><span class="Identifier">Partial</span></span></tt>, so a reference to it serializes as a <tt class="docutils literal"><span class="pre"><span class="Identifier">SymUse</span></span></tt> that a cg/emit consumer resolves from the <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">bif</span></span></tt> (loader fallback <tt class="docutils literal"><span class="pre"><span class="Identifier">typeCursor</span></span></tt>/<tt class="docutils literal"><span class="pre"><span class="Identifier">ensureSemBuf</span></span></tt>) — the lower stage leaves those defs unchanged, so re-emitting them into <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">bif</span></span></tt> was pure cost. Collect names first: <tt class="docutils literal"><span class="pre"><span class="Identifier">createTypeStub</span></span></tt> may register modules / mutate <tt class="docutils literal"><span class="pre"><span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">types</span></span></tt>, which must not invalidate the index iterator.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2989" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2989" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="loadNifModule-procs-all">
|
|
<div id="loadNifModule,DecodeContext,FileIndex,TStrTable,TStrTable,set[LoadFlag]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#loadNifModule%2CDecodeContext%2CFileIndex%2CTStrTable%2CTStrTable%2Cset%5BLoadFlag%5D"><span class="Identifier">loadNifModule</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">f</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">;</span>
|
|
<span class="Identifier">interf</span><span class="Other">,</span> <span class="Identifier">interfHidden</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="#LoadFlag"><span class="Identifier">LoadFlag</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <a href="#PrecompiledModule"><span class="Identifier">PrecompiledModule</span></a> {.
|
|
<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">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3394" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3394" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
<div id="loadNifModule,DecodeContext,ModuleSuffix,TStrTable,TStrTable,set[LoadFlag]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#loadNifModule%2CDecodeContext%2CModuleSuffix%2CTStrTable%2CTStrTable%2Cset%5BLoadFlag%5D"><span class="Identifier">loadNifModule</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">suffix</span><span class="Other">:</span> <a href="#ModuleSuffix"><span class="Identifier">ModuleSuffix</span></a><span class="Other">;</span>
|
|
<span class="Identifier">interf</span><span class="Other">,</span> <span class="Identifier">interfHidden</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="astdef.html#TStrTable"><span class="Identifier">TStrTable</span></a><span class="Other">;</span>
|
|
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="#LoadFlag"><span class="Identifier">LoadFlag</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">)</span><span class="Other">:</span> <a href="#PrecompiledModule"><span class="Identifier">PrecompiledModule</span></a> {.
|
|
<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">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3372" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3372" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="loadSym-procs-all">
|
|
<div id="loadSym,DecodeContext,PSym">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#loadSym%2CDecodeContext%2CPSym"><span class="Identifier">loadSym</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">s</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</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">KeyError</span><span class="Other">,</span> <span class="Identifier">OSError</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="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">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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2622" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2622" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="loadType-procs-all">
|
|
<div id="loadType,DecodeContext,PType">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#loadType%2CDecodeContext%2CPType"><span class="Identifier">loadType</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">t</span><span class="Other">:</span> <a href="astdef.html#PType"><span class="Identifier">PType</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">KeyError</span><span class="Other">,</span> <span class="Identifier">OSError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2498" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2498" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="materializeLazyBody-procs-all">
|
|
<div id="materializeLazyBody,DecodeContext,PNode">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#materializeLazyBody%2CDecodeContext%2CPNode"><span class="Identifier">materializeLazyBody</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">node</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</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">KeyError</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">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">ReadDirEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</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="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Fill a <tt class="docutils literal"><span class="pre"><span class="Identifier">nfLazyBody</span></span></tt> placeholder's children in place (identity-preserving: callers already hold <tt class="docutils literal"><span class="pre"><span class="Identifier">node</span></span></tt>). Decodes the deferred body from the stashed cursor with the enclosing def's <tt class="docutils literal"><span class="pre"><span class="Identifier">localSyms</span></span></tt> so param/local refs resolve to the SAME PSyms the signature created.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2892" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2892" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="moduleSymbolStubs-procs-all">
|
|
<div id="moduleSymbolStubs,DecodeContext,FileIndex">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#moduleSymbolStubs%2CDecodeContext%2CFileIndex"><span class="Identifier">moduleSymbolStubs</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#PSym"><span class="Identifier">PSym</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">KeyError</span><span class="Other">,</span> <span class="Identifier">OSError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
<p>Stubs for every non-type symbol serialized in <tt class="docutils literal"><span class="pre"><span class="Identifier">module</span></span></tt>'s NIF index. The per-module backend uses this to emit the routines a module OWNS: procs are serialized as <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">sd</span> <span class="Operator">...</span><span class="Punctuation">)</span></span></tt> symbol-defs and loaded lazily, never as <tt class="docutils literal"><span class="pre"><span class="Identifier">nkProcDef</span></span></tt> statements in the top-level stmt list, so <tt class="docutils literal"><span class="pre"><span class="Identifier">genTopLevelStmt</span></span></tt> alone never reaches them — without this, a routine called only from other modules would be emitted by nobody once the demanding module merely prototypes it.</p>
|
|
<p>Returns lazy stubs: the index table is moved out while iterating (loading a symbol can register new modules and invalidate the iterator), so the caller forces full load (<tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">kind</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">ast</span></span></tt>) and filters AFTER this returns, with the index back in place.</p>
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2966" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2966" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="nextBackendSymItem-procs-all">
|
|
<div id="nextBackendSymItem,DecodeContext,int32">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#nextBackendSymItem%2CDecodeContext%2Cint32"><span class="Identifier">nextBackendSymItem</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <span class="Identifier">int32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int32</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">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Allocate the next backend-minted SYM item for <tt class="docutils literal"><span class="pre"><span class="Identifier">module</span></span></tt> from the SAME per-module counter the loader uses when it re-homes <tt class="docutils literal"><span class="pre"><span class="Operator">@</span><span class="Identifier">bk</span></span></tt> syms loaded from the module's <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">bif</span></span></tt> (loadSymStub/extractLocalSymsFromTree). The <tt class="docutils literal"><span class="pre"><span class="Identifier">lower</span></span></tt> stage serializes its lifted hooks/temps as <tt class="docutils literal"><span class="pre"><span class="Operator">@</span><span class="Identifier">bk</span></span></tt> syms, and cg mints MORE backend syms (RTTI destroy wrappers, ...) into the same module. Both are keyed by <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">id</span></span></tt> (= <tt class="docutils literal"><span class="pre"><span class="Identifier">toId</span><span class="Punctuation">(</span><span class="Identifier">itemId</span><span class="Punctuation">)</span></span></tt>) in <tt class="docutils literal"><span class="pre"><span class="Identifier">declaredThings</span></span></tt>/<tt class="docutils literal"><span class="pre"><span class="Identifier">declaredProtos</span></span></tt>, so if the two id producers (the loader's <tt class="docutils literal"><span class="pre"><span class="Identifier">symCounter</span></span></tt> and cg's idgen) ran independently they could mint the same item: e.g. a <tt class="docutils literal"><span class="pre"><span class="Identifier">rttiDestroy</span></span></tt> wrapper and the very <tt class="docutils literal"><span class="pre"><span class="Operator">=</span><span class="Identifier">destroy</span></span></tt> hook it wraps both land on backend item 21 -> one masks the other in <tt class="docutils literal"><span class="pre"><span class="Identifier">declaredThings</span></span></tt> -> the hook's body is never emitted -> "undefined reference" at link. Drawing every backend sym from this one counter keeps them disjoint. Returns -1 if the module is not loaded yet (then the caller falls back to the idgen's own counter — only reachable for sem-time <tt class="docutils literal"><span class="pre"><span class="Operator">@</span><span class="Identifier">bk</span></span></tt> minting, whose module is never loaded in that process).
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1967" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1967" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="nextBackendTypeItem-procs-all">
|
|
<div id="nextBackendTypeItem,DecodeContext,int32">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#nextBackendTypeItem%2CDecodeContext%2Cint32"><span class="Identifier">nextBackendTypeItem</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">module</span><span class="Other">:</span> <span class="Identifier">int32</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int32</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">KeyError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
TYPE analogue of <tt class="docutils literal"><span class="pre"><span class="Identifier">nextBackendSymItem</span></span></tt>: the <tt class="docutils literal"><span class="pre"><span class="Identifier">lower</span></span></tt>/<tt class="docutils literal"><span class="pre"><span class="Identifier">cg</span></span></tt> stages mint fresh backend TYPES (closure-env objects, ptr wrappers) whose itemId must not collide with the module's loaded types. Drawn from the per-module <tt class="docutils literal"><span class="pre"><span class="Identifier">typeCounter</span></span></tt>, which <tt class="docutils literal"><span class="pre"><span class="Identifier">moduleId</span></span></tt> seeds from the file's <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">unusedid</span><span class="Punctuation">)</span></span></tt> so the first minted type sits ABOVE every frontend/lowered type item. Returns -1 if the module is not loaded (caller falls back to the idgen's own counter).
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1988" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1988" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="nifModuleHasIncludes-procs-all">
|
|
<div id="nifModuleHasIncludes,ConfigRef,FileIndex">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#nifModuleHasIncludes%2CConfigRef%2CFileIndex"><span class="Identifier">nifModuleHasIncludes</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">fileIdx</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><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">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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
Cheap header-only check: does the module's <tt class="docutils literal"><span class="pre"><span class="Operator"><</span><span class="Identifier">suffix</span><span class="Operator">>.</span><span class="Identifier">nif</span></span></tt> contain an <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Keyword">include</span> <span class="Operator">...</span><span class="Punctuation">)</span></span></tt> record? Used by nimsuggest (<tt class="docutils literal"><span class="pre"><span class="Identifier">moduleFromNifFile</span></span></tt>) to refuse to NIF-serve modules that <tt class="docutils literal"><span class="pre"><span class="Keyword">include</span></span></tt> files, so the includer is source-compiled and the included symbols never round-trip through NIF (which mishandles their owner/line-info on reload).
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3182" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3182" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="parseSymName-procs-all">
|
|
<div id="parseSymName,string">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#parseSymName%2Cstring"><span class="Identifier">parseSymName</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="#ParsedSymName"><span class="Identifier">ParsedSymName</span></a> {.<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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L357" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L357" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="registerNifAstTags-procs-all">
|
|
<div id="registerNifAstTags">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#registerNifAstTags"><span class="Identifier">registerNifAstTags</span></a><span class="Other">(</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
(Re)registers ast2nif's NIF tags explicitly. The top-level <tt class="docutils literal"><span class="pre"><span class="Identifier">registerTag</span></span></tt> initializers above depend on <tt class="docutils literal"><span class="pre"><span class="Identifier">nifstreams</span><span class="Operator">.</span><span class="Identifier">pool</span></span></tt> having been initialized FIRST (<tt class="docutils literal"><span class="pre"><span class="Identifier">pool</span> <span class="Operator">=</span> <span class="Identifier">createLiterals</span><span class="Punctuation">(</span><span class="Identifier">TagData</span><span class="Punctuation">)</span></span></tt> in nifstreams' module init) — an inter-module init-order requirement. The IC-built compiler currently emits module init calls in a different order, so the initializers registered into a pool that was subsequently replaced: the tag ids then denoted builtin tags (<tt class="docutils literal"><span class="pre"><span class="Identifier">replay</span></span></tt> came out as <tt class="docutils literal"><span class="pre"><span class="Identifier">deref</span></span></tt>, <tt class="docutils literal"><span class="pre"><span class="Identifier">repdestroy</span></span></tt> as <tt class="docutils literal"><span class="pre"><span class="Identifier">pat</span></span></tt>, ...) and every written NIF was silently corrupted. Called from <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span><span class="Operator">.</span><span class="Identifier">nim</span></span></tt> before any command runs; idempotent (<tt class="docutils literal"><span class="pre"><span class="Identifier">getOrIncl</span></span></tt> by name).
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L917" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L917" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="resolveHookSym-procs-all">
|
|
<div id="resolveHookSym,DecodeContext,string">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#resolveHookSym%2CDecodeContext%2Cstring"><span class="Identifier">resolveHookSym</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a> {.
|
|
<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">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</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">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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2667" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2667" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="scanIncludeGraph-procs-all">
|
|
<div id="scanIncludeGraph,ConfigRef">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#scanIncludeGraph%2CConfigRef"><span class="Identifier">scanIncludeGraph</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span>
|
|
<span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">includer</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">,</span> <span class="Identifier">includes</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span><span class="Other">]</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">OSError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
<p>Standalone "full table" scan of every <tt class="docutils literal"><span class="pre"><span class="Operator"><</span><span class="Identifier">suffix</span><span class="Operator">>.</span><span class="Identifier">nif</span></span></tt> in the nimcache: reads only each module's header records — <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">modulesrc</span> <span class="StringLit">"path"</span><span class="Punctuation">)</span></span></tt> (the includer's own source) and <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Keyword">include</span> <span class="Operator">.</span> <span class="Operator">.</span> <span class="StringLit">"path"</span><span class="Operator">...</span><span class="Punctuation">)</span></span></tt> (resolved included files) — and returns (includerSource, includedSources) pairs for the modules that <tt class="docutils literal"><span class="pre"><span class="Keyword">include</span></span></tt> anything. No <tt class="docutils literal"><span class="pre"><span class="Identifier">DecodeContext</span></span></tt>, no symbol/index loading: it parses the few dep tokens at the top of the file and stops at the first non-dep node.</p>
|
|
<p>Used by nimsuggest to answer, for a cold-opened <em>include</em> file, "which module includes me?" without NIF-loading that module — so the includer can be <em>source</em>-compiled (modules that <tt class="docutils literal"><span class="pre"><span class="Keyword">include</span></span></tt> files are never served from NIF).</p>
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3136" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3136" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="sealLoadedRoutines-procs-all">
|
|
<div id="sealLoadedRoutines,DecodeContext">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#sealLoadedRoutines%2CDecodeContext"><span class="Identifier">sealLoadedRoutines</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Before <tt class="docutils literal"><span class="pre"><span class="Identifier">writeLoweredModule</span></span></tt> re-serializes the lowered module, seal ONLY the module's ROUTINE syms. A <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">nif</span></span></tt> written by <tt class="docutils literal"><span class="pre"><span class="Identifier">writeLoweredModule</span></span></tt> is the SOLE source the <tt class="docutils literal"><span class="pre"><span class="Identifier">cg</span></span></tt> stage loads (there is no <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">nif</span></span></tt> fallback for its bodies), so every type, global, param and local must still emit a REAL def in it — only cross-routine references may be <tt class="docutils literal"><span class="pre"><span class="Identifier">SymUse</span></span></tt>s (each routine's def is emitted once, at module scope, by the explicit stub loop). Types/globals stay <tt class="docutils literal"><span class="pre"><span class="Identifier">Complete</span></span></tt> so <tt class="docutils literal"><span class="pre"><span class="Identifier">writeType</span></span></tt>/<tt class="docutils literal"><span class="pre"><span class="Identifier">writeGlobals</span></span></tt> emit them; routines become <tt class="docutils literal"><span class="pre"><span class="Identifier">Sealed</span></span></tt> so a body referencing another routine writes a <tt class="docutils literal"><span class="pre"><span class="Identifier">SymUse</span></span></tt> resolved through the module index.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2653" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2653" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="setMainModule-procs-all">
|
|
<div id="setMainModule,DecodeContext,FileIndex">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#setMainModule%2CDecodeContext%2CFileIndex"><span class="Identifier">setMainModule</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">fileIdx</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</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="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Records the module that is being compiled fresh so that re-exports of its own symbols by dependencies are not turned into duplicate stubs.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L2001" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L2001" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="toClassSymId-procs-all">
|
|
<div id="toClassSymId,ConfigRef,ItemId">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toClassSymId%2CConfigRef%2CItemId"><span class="Identifier">toClassSymId</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">typeId</span><span class="Other">:</span> <a href="itemids.html#ItemId"><span class="Identifier">ItemId</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Converts a type ItemId to its SymId for the class index.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L112" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L112" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="toConverterIndexEntry-procs-all">
|
|
<div id="toConverterIndexEntry,ConfigRef,PSym">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toConverterIndexEntry%2CConfigRef%2CPSym"><span class="Identifier">toConverterIndexEntry</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">converterSym</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span>
|
|
<span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</span><span class="Other">,</span> <span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Converts a converter symbol to an index entry (destType, converterSym). Returns the destination type's SymId and the converter's SymId.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L89" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L89" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="toHookIndexEntry-procs-all">
|
|
<div id="toHookIndexEntry,ConfigRef,ItemId,PSym">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toHookIndexEntry%2CConfigRef%2CItemId%2CPSym"><span class="Identifier">toHookIndexEntry</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">typeId</span><span class="Other">:</span> <a href="itemids.html#ItemId"><span class="Identifier">ItemId</span></a><span class="Other">;</span> <span class="Identifier">hookSym</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">HookIndexEntry</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Converts a type ItemId and hook symbol to a HookIndexEntry for the NIF index.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L78" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L78" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="toMethodIndexEntry-procs-all">
|
|
<div id="toMethodIndexEntry,ConfigRef,PSym,string">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toMethodIndexEntry%2CConfigRef%2CPSym%2Cstring"><span class="Identifier">toMethodIndexEntry</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">methodSym</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">;</span> <span class="Identifier">signature</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Other">(</span>
|
|
<span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">SymId</span><span class="Other">,</span> <span class="Identifier">nifstreams</span><span class="Other">.</span><span class="Identifier">StrId</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="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</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>
|
|
|
|
Converts a method symbol/signature to a method index entry.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L104" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L104" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="toNifFilename-procs-all">
|
|
<div id="toNifFilename,ConfigRef,FileIndex">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#toNifFilename%2CConfigRef%2CFileIndex"><span class="Identifier">toNifFilename</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">f</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</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="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">ReadDirEffect</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>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3009" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3009" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="tryResolveCompilerProc-procs-all">
|
|
<div id="tryResolveCompilerProc,DecodeContext,string,FileIndex">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#tryResolveCompilerProc%2CDecodeContext%2Cstring%2CFileIndex"><span class="Identifier">tryResolveCompilerProc</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">;</span>
|
|
<span class="Identifier">moduleFileIdx</span><span class="Other">:</span> <a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">)</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a> {.
|
|
<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">Exception</span><span class="Other">,</span> <span class="Identifier">KeyError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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>
|
|
|
|
Tries to resolve a compiler proc from a module by checking the NIF index. Returns nil if the symbol doesn't exist. The NIF disamb is mint order, so <tt class="docutils literal"><span class="pre"><span class="Identifier">name</span><span class="Operator">.</span><span class="FloatNumber">0.</span></span></tt> can be any of the overloads sharing the name — for <tt class="docutils literal"><span class="pre"><span class="Identifier">newSeq</span></span></tt> it is the generic magic, not the RTL proc (a refc build then demands codegen of the generic and dies on <tt class="docutils literal"><span class="pre"><span class="Identifier">seq</span><span class="Punctuation">[</span><span class="Identifier">T</span><span class="Punctuation">]</span></span></tt>): enumerate the index entries with this basename and pick the one that carries <tt class="docutils literal"><span class="pre"><span class="Identifier">sfCompilerProc</span></span></tt>.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3054" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3054" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="writeLoweredModule-procs-all">
|
|
<div id="writeLoweredModule,DecodeContext,ConfigRef,PrecompiledModule,openArray[LogEntry],string">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#writeLoweredModule%2CDecodeContext%2CConfigRef%2CPrecompiledModule%2CopenArray%5BLogEntry%5D%2Cstring"><span class="Identifier">writeLoweredModule</span></a><span class="Other">(</span><span class="Identifier">c</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="#DecodeContext"><span class="Identifier">DecodeContext</span></a><span class="Other">;</span> <span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span>
|
|
<span class="Identifier">precomp</span><span class="Other">:</span> <a href="#PrecompiledModule"><span class="Identifier">PrecompiledModule</span></a><span class="Other">;</span> <span class="Identifier">hooks</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><a href="astdef.html#LogEntry"><span class="Identifier">LogEntry</span></a><span class="Other">]</span><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">KeyError</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">IOError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</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="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
Re-serialize a backend-loaded module as a FULL module NIF (<tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">t</span><span class="Operator">.</span><span class="Identifier">nif</span></span></tt>) whose routine <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">sd</span><span class="Punctuation">)</span></span></tt> entries carry their TRANSFORMED bodies (the <tt class="docutils literal"><span class="pre"><span class="Identifier">lower</span></span></tt> stage set them, recursively lifting nested closures — including the async state-machine procs whose inner closure the per-<tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">lowered</span><span class="Punctuation">)</span></span></tt>-entry path failed to cross) and whose lambda-lift-minted entities (closure-env types/syms, lifted nested procs) are real, indexed defs. The <tt class="docutils literal"><span class="pre"><span class="Identifier">cg</span></span></tt> stage then loads it through the normal module loader (<tt class="docutils literal"><span class="pre"><span class="Identifier">moduleFromNifFile</span></span></tt>), so a transformed body arrives via <tt class="docutils literal"><span class="pre"><span class="Identifier">loadSymFromCursor</span></span></tt>'s Step-A 2-way-body slot WITH the lifted signature — no <tt class="docutils literal"><span class="pre"><span class="Punctuation">(</span><span class="Identifier">lowered</span><span class="Punctuation">)</span></span></tt> side-car, no <tt class="docutils literal"><span class="pre"><span class="Punctuation">:</span><span class="Identifier">envP</span></span></tt> re-weld. This realizes <tt class="docutils literal"><span class="pre"><span class="Identifier">ic_ideas</span><span class="Operator">.</span><span class="Identifier">md</span></span></tt>'s eager two-way body whole-module.
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L3399" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L3399" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="writeNifModule-procs-all">
|
|
<div id="writeNifModule,ConfigRef,int32,PNode,seq[LogEntry],seq[PNode],seq[int],seq[],seq[tuple[PSym,PSym,seq[PType],int]],seq[tuple[PSym,PType]],seq[FileIndex],int32,seq[]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#writeNifModule%2CConfigRef%2Cint32%2CPNode%2Cseq%5BLogEntry%5D%2Cseq%5BPNode%5D%2Cseq%5Bint%5D%2Cseq%5B%5D%2Cseq%5Btuple%5BPSym%2CPSym%2Cseq%5BPType%5D%2Cint%5D%5D%2Cseq%5Btuple%5BPSym%2CPType%5D%5D%2Cseq%5BFileIndex%5D%2Cint32%2Cseq%5B%5D"><span class="Identifier">writeNifModule</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">thisModule</span><span class="Other">:</span> <span class="Identifier">int32</span><span class="Other">;</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">;</span>
|
|
<span class="Identifier">opsLog</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#LogEntry"><span class="Identifier">LogEntry</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">replayActions</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#PNode"><span class="Identifier">PNode</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</span><span class="Other">[</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">implDeps</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">int</span><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</span><span class="Other">[</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">reexportedModules</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Other">(</span><span class="Identifier">string</span><span class="Other">,</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</span><span class="Other">[</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">genericOffers</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">generic</span><span class="Other">,</span> <span class="Identifier">inst</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">,</span> <span class="Identifier">concreteTypes</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">]</span><span class="Other">,</span>
|
|
<span class="Identifier">genericParamsCount</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">]</span><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</span><span class="Other">[</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">typeOffers</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">generic</span><span class="Other">:</span> <a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">,</span> <span class="Identifier">inst</span><span class="Other">:</span> <a href="astdef.html#PType"><span class="Identifier">PType</span></a><span class="Other">]</span><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</span><span class="Other">[</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">resolvedImportDeps</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="lineinfos.html#FileIndex"><span class="Identifier">FileIndex</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</span><span class="Other">[</span><span class="Other">]</span><span class="Other">;</span>
|
|
<span class="Identifier">firstUnusedId</span><span class="Other">:</span> <span class="Identifier">int32</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span>
|
|
<span class="Identifier">expansions</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Other">(</span><a href="astdef.html#PSym"><span class="Identifier">PSym</span></a><span class="Other">,</span> <a href="lineinfos.html#TLineInfo"><span class="Identifier">TLineInfo</span></a><span class="Other">)</span><span class="Other">]</span> <span class="Other">=</span> <span class="Operator">@</span><span class="Other">[</span><span class="Other">]</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">KeyError</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">IOError</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">RootEffect</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="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1625" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1625" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</dd>
|
|
</div>
|
|
|
|
</div>
|
|
<div id="writeSemDeps-procs-all">
|
|
<div id="writeSemDeps,ConfigRef,int32,seq[string]">
|
|
<dt><pre><span class="Keyword">proc</span> <a href="#writeSemDeps%2CConfigRef%2Cint32%2Cseq%5Bstring%5D"><span class="Identifier">writeSemDeps</span></a><span class="Other">(</span><span class="Identifier">config</span><span class="Other">:</span> <a href="options.html#ConfigRef"><span class="Identifier">ConfigRef</span></a><span class="Other">;</span> <span class="Identifier">thisModule</span><span class="Other">:</span> <span class="Identifier">int32</span><span class="Other">;</span> <span class="Identifier">importPaths</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</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">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</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">ReadEnvEffect</span><span class="Other">,</span> <span class="Identifier">ReadIOEffect</span><span class="Other">,</span>
|
|
<span class="Identifier">WriteIOEffect</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="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
|
<dd>
|
|
|
|
<p>The module's REAL direct imports as <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">m</span></span></tt> sem resolved them — static plus any a macro generated — recorded as full source paths. <tt class="docutils literal"><span class="pre"><span class="Identifier">nim</span> <span class="Identifier">ic</span></span></tt> reads this <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">s</span><span class="Operator">.</span><span class="Identifier">deps</span><span class="Operator">.</span><span class="Identifier">nif</span></span></tt> to re-derive the build graph: imports the static scanner missed become new nodes (replacing the old build-failure discovery loop), and <tt class="docutils literal"><span class="pre"><span class="Keyword">when</span> <span class="Identifier">false</span></span></tt> imports the scanner over-included are pruned. Always written so it is current after every successful sem (like <tt class="docutils literal"><span class="pre"><span class="Operator">.</span><span class="Identifier">edges</span></span></tt>).</p>
|
|
<p>Ported to nifcore: delegates to <tt class="docutils literal"><span class="pre"><span class="Identifier">icnifcore</span><span class="Operator">.</span><span class="Identifier">writeSemDeps</span></span></tt> (Stage 1 of the NIF-stack migration; see doc/ic_nifcore_port.md). Output is byte-identical to the previous <tt class="docutils literal"><span class="pre"><span class="Identifier">nifstreams</span></span></tt> writer.</p>
|
|
|
|
<a href="https://github.com/nim-lang/Nim/tree/devel/compiler/ast2nif.nim#L1612" class="link-seesrc" target="_blank">Source</a>
|
|
<a href="https://github.com/nim-lang/Nim/edit/devel/compiler/ast2nif.nim#L1612" class="link-seesrc" target="_blank" >Edit</a>
|
|
|
|
</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-31 03:44:06 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
|
|
|
|
</body>
|
|
</html>
|