Skip to content

IC: don't rerun the config producer after a no-op nim.cfg save - #26686

Merged
Araq merged 2 commits into
nim-lang:develfrom
nitely:ns_nif_spawn_fix2
Nov 12, 2026
Merged

Araq merged 2 commits into
nim-lang:develfrom
nitely:ns_nif_spawn_fix2

Conversation

@nitely

@nitely nitely commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Saving a nim.cfg without changing it made every later nim ic and nim track run start the nim icconfig producer again, until the content changed.

The precompiled config is written only when its content changes, so its mtime stayed older than the saved source, and sourcesChanged compared against that mtime. The driver now sets the config's mtime to when the producer started, after every producer run. That also catches a config source saved while the producer was running.

Split from #26494

@nitely
nitely marked this pull request as ready for review November 11, 2026 03:35
@Araq

Araq commented Nov 11, 2026

Copy link
Copy Markdown
Member

The precompiled config is written only when its content changes

Change that instead.

@nitely

nitely commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor Author

The precompiled config is written only when its content changes

Change that instead.

but then there is a window in which the precompiled config may be newer than the config (in nimbus up to 500 ms) and then the changes in that window are not picked up until the config is changed again. That window also exists on devel when there are config changes.

This fix closes that window by updating the mtime at the end. The stamp file is not needed though; the comment for OnlyIfChanged was outdated.

I think the issue I originally hit was the no-op config change, not the window race, though.

@Araq
Araq merged commit bd6cf35 into nim-lang:devel Nov 12, 2026
19 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from bd6cf35

Hint: codegen mm: orc; threads: on; opt: speed; options: -d:release
220702 lines; 13.343s; 640.875MiB peakmem

@nitely
nitely deleted the ns_nif_spawn_fix2 branch November 13, 2026 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants