0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00

compiler: don't mutate the InternPool when printing types and values

This change at long last replaces the `Zcu.PerThread` parameters in
`Type.print` and `Value.print` with `*Zcu` parameters. This required
various tweaks to avoid the need to intern values when printing them.
The most significant change is to `Value.pointerDerivation`, whose API
and implementation has been changed quite a bit. This API is used by the
C and SPIR-V backends, which I therefore also needed to update---but it
seems to have been surprisingly painless overall!

Most of this diff comes from replacing `fmt(pt)` with `fmt(zcu)` (plus a
few more similar patterns), then following compile errors for a while to
change parameters/constants/fields from `pt` to `zcu` where necessary.
Actual logic changes should be limited to the following source files:

* `src/print_value.zig`
* `src/Type.zig`
* `src/Value.zig`
* `src/codegen/c.zig`
* `src/codegen/spirv/CodeGen.zig`
This commit is contained in:
Matthew Lugg 2026-09-26 17:43:41 +01:00
commit ebb8683ef1
No known key found for this signature in database
GPG key ID: 3F5B7DCCBF4AF02E
26 changed files with 1587 additions and 1426 deletions