aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-06-29 01:36:25 +0100
committermlugg <mlugg@mlugg.co.uk>2024-07-04 21:01:41 +0100
commit7e552dc1e9a8388f71cc32083deb9dd848e79808 (patch)
treeb1c1086002c91be0e6c1195cc18966906a171ce3 /src/codegen.zig
parentbc8cd135987c7dc7419d034ba31178331d606cfa (diff)
downloadzig-7e552dc1e9a8388f71cc32083deb9dd848e79808.tar.gz
zig-7e552dc1e9a8388f71cc32083deb9dd848e79808.zip
Zcu: rework exports
This commit reworks our representation of exported Decls and values in Zcu to be memory-optimized and trivially serialized. All exports are now stored in the `all_exports` array on `Zcu`. An `AnalUnit` which performs an export (either through an `export` annotation or by containing an analyzed `@export`) gains an entry into `single_exports` if it performs only one export, or `multi_exports` if it performs multiple. We no longer store a persistent mapping from a `Decl`/value to all exports of that entity; this state is not necessary for the majority of the pipeline. Instead, we construct it in `Zcu.processExports`, just before flush. This does not affect the algorithmic complexity of `processExports`, since this function already iterates all exports in the `Zcu`. The elimination of `decl_exports` and `value_exports` led to a few non-trivial backend changes. The LLVM backend has been wrangled into a more reasonable state in general regarding exports and externs. The C backend is currently disabled in this commit, because its support for `export` was quite broken, and that was exposed by this work -- I'm hoping @jacobly0 will be able to pick this up!
Diffstat (limited to 'src/codegen.zig')
0 files changed, 0 insertions, 0 deletions