Files
Nim/compiler
araq 2605cd3213 IC: take the module index from the .bif instead of rescanning for it
`moduleId` threw away the index `bif.load` hands it and rebuilt an equivalent
one by walking the module's ENTIRE token stream, allocating a string per
`SymbolDef` — once per module, per backend process. That was 909ms of a 10.1s
cold `--ic:on` build. Taking the carried index instead: 220ms, and the build
drops to 9.4s.

`bif.store` already builds that index in one forward traversal at write time
(`bif.buildIndex`) and writes it into the file, and `bif.load` reads it back
with `pos` already a TOKEN index of the declaration's enclosing tag — the very
thing the rescan recomputed. The comment claiming the file's offsets are
"meaningless once the file is parsed" was true of the older byte-offset
`readEmbeddedIndex`; it stopped being true when `bif` started storing token
positions.

The two agree BY CONSTRUCTION, and the reason is worth stating because "the
file has an index" would not be enough on its own: the writer filters with
`bif.isGlobalSymbol(name, dottedSuffix)`, every `storeBif` call site passes
`"." & extractModuleSuffix(path)` — the same suffix the reader forms — and the
visibility rule is the same test on the same token.

Checked rather than argued, all the same. The old rescan stays as
`rescanPosIndex` behind `-d:icIndexCheck`, which compares the two entry by
entry on every module load: a full build agrees exactly (11220 entries for the
system module alone), and sabotaging the comparison makes it fire, so the clean
run says something.

`ensureSemBuf` had the same rescan for the `.s.bif` companion; it uses the
carried index too.

Verified: both configurations build; `tests/ic` 40/40; 67/67 generated `.c`
byte-identical to before, and cursor still identical to `PNode`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FMyRHByv7hhaQJ4Pa1bHbE
2026-08-30 23:30:30 +02:00
..
2026-06-11 14:10:42 +02:00
2026-02-10 13:21:35 +01:00
2026-06-25 23:20:34 +02:00
2026-08-27 19:35:11 +02:00
2026-08-27 19:35:11 +02:00
2026-08-27 19:35:11 +02:00
2017-01-07 22:35:09 +01:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2025-12-11 18:22:38 +01:00
2025-12-11 18:22:38 +01:00
2026-08-27 19:35:11 +02:00
2026-07-03 15:52:41 +02:00
2026-07-04 10:13:39 +02:00
2025-11-25 12:49:23 +01:00
2026-08-17 15:02:49 +02:00
2024-12-27 19:42:18 +01:00
2026-06-14 22:35:06 +02:00
2026-08-17 15:02:49 +02:00
2025-12-11 18:22:38 +01:00
2026-04-02 07:19:43 +02:00
2026-06-14 22:35:06 +02:00
2026-06-25 23:20:34 +02:00
2021-01-12 09:36:51 +01:00
2026-08-27 19:35:11 +02:00
2026-01-09 13:10:04 +01:00
2026-06-14 22:35:06 +02:00
2026-08-17 15:02:49 +02:00
2026-07-03 15:52:41 +02:00
2026-08-27 19:35:11 +02:00
2026-06-24 21:58:51 +02:00
2025-12-11 18:22:38 +01:00
2026-08-27 19:35:11 +02:00
2026-08-17 15:02:49 +02:00
2026-06-14 22:35:06 +02:00
2026-08-27 19:35:11 +02:00
2026-08-17 15:02:49 +02:00
2026-02-10 13:21:35 +01:00
2026-08-17 15:02:49 +02:00
2023-07-02 22:36:05 +02:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2026-08-11 22:27:49 +02:00
2025-12-11 18:22:38 +01:00
2026-08-17 15:02:49 +02:00
2025-12-11 18:22:38 +01:00
2026-08-27 19:35:11 +02:00
2026-08-17 15:02:49 +02:00
2025-12-11 18:22:38 +01:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2026-06-24 21:58:51 +02:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2026-08-17 15:02:49 +02:00
2023-12-25 07:12:54 +01:00

Nim Compiler

  • This directory contains the Nim compiler written in Nim.
  • Note that this code has been translated from a bootstrapping version written in Pascal.
  • So the code is not a poster child of good Nim code.

See Internals of the Nim Compiler for more information.