diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-12-22 21:16:29 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-12-24 02:18:41 +0000 |
| commit | 40aafcd6a85d3c517f445f17149c17523c832420 (patch) | |
| tree | b8e1a5361c6a20ce9e3ba568b61b199aff1c8f13 /test/cases/compile_errors/self_reference_missing_const.zig | |
| parent | 18362ebe13ece2ea7c4f57303ec4687f55d2dba5 (diff) | |
| download | zig-40aafcd6a85d3c517f445f17149c17523c832420.tar.gz zig-40aafcd6a85d3c517f445f17149c17523c832420.zip | |
compiler: remove Cau
The `Cau` abstraction originated from noting that one of the two primary
roles of the legacy `Decl` type was to be the subject of comptime
semantic analysis. However, the data stored in `Cau` has always had some
level of redundancy. While preparing for #131, I went to remove that
redundany, and realised that `Cau` now had exactly one field: `owner`.
This led me to conclude that `Cau` is, in fact, an unnecessary level of
abstraction over what are in reality *fundamentally different* kinds of
analysis unit (`AnalUnit`). Types, `Nav` vals, and `comptime`
declarations are all analyzed in different ways, and trying to treat
them as the same thing is counterproductive!
So, these 3 cases are now different alternatives in `AnalUnit`. To avoid
stealing bits from `InternPool`-based IDs, which are already a little
starved for bits due to the sharding datastructures, `AnalUnit` is
expanded to 64 bits (30 of which are currently unused). This doesn't
impact memory usage too much by default, because we don't store
`AnalUnit`s all too often; however, we do store them a lot under
`-fincremental`, so a non-trivial bump to peak RSS can be observed
there. This will be improved in the future when I made
`InternPool.DepEntry` less memory-inefficient.
`Zcu.PerThread.ensureCauAnalyzed` is split into 3 functions, for each of
the 3 new types of `AnalUnit`. The new logic is much easier to
understand, because it avoids conflating the logic of these
fundamentally different cases.
Diffstat (limited to 'test/cases/compile_errors/self_reference_missing_const.zig')
0 files changed, 0 insertions, 0 deletions
