aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation/Config.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-01-04 05:09:02 +0000
committermlugg <mlugg@mlugg.co.uk>2025-01-04 07:51:19 +0000
commitf01029c4af7d3015c1c3f7d36bb62f7d5afb53a4 (patch)
tree21fd6696e57bc59fb1c097903e8421562d0862f5 /src/Compilation/Config.zig
parentfd62912787ee4f26b06ba86560e9aa605095ae04 (diff)
downloadzig-f01029c4af7d3015c1c3f7d36bb62f7d5afb53a4.tar.gz
zig-f01029c4af7d3015c1c3f7d36bb62f7d5afb53a4.zip
incremental: new `AnalUnit` to group dependencies on `std.builtin` decls
This commit reworks how values like the panic handler function are memoized during a compiler invocation. Previously, the value was resolved by whichever analysis requested it first, and cached on `Zcu`. This is problematic for incremental compilation, as after the initial resolution, no dependencies are marked by users of this memoized state. This is arguably acceptable for `std.builtin`, but it's definitely not acceptable for the panic handler/messages, because those can be set by the user (`std.builtin.Panic` checks `@import("root").Panic`). So, here we introduce a new kind of `AnalUnit`, called `memoized_state`. There are 3 such units: * `.{ .memoized_state = .va_list }` resolves the type `std.builtin.VaList` * `.{ .memoized_state = .panic }` resolves `std.Panic` * `.{ .memoized_state = .main }` resolves everything else we want These units essentially "bundle" the resolution of their corresponding declarations, storing the results into fields on `Zcu`. This way, when, for instance, a function wants to call the panic handler, it simply runs `ensureMemoizedStateResolved`, registering one dependency, and pulls the values from the `Zcu`. This "bundling" minimizes dependency edges. The 3 units are separated to allow them to act independently: for instance, the panic handler can use `std.builtin.Type` without triggering a dependency loop.
Diffstat (limited to 'src/Compilation/Config.zig')
0 files changed, 0 insertions, 0 deletions