diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-02-24 04:29:42 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-02-26 13:20:45 +0000 |
| commit | 59447e53056d8fb6682b79accccffa176d0b44d1 (patch) | |
| tree | fef7809520fc67d519150592ea479576c9b289ca /lib/std/zig.zig | |
| parent | 031f23117dadd84b1e7189ee5b0f712eeb23ca1e (diff) | |
| download | zig-59447e53056d8fb6682b79accccffa176d0b44d1.tar.gz zig-59447e53056d8fb6682b79accccffa176d0b44d1.zip | |
compiler: decide dbg_var scoping based on AIR blocks
This commit eliminates the `dbg_block_{begin,end}` instructions from
both ZIR and AIR. Instead, lexical scoping of `dbg_var_{ptr,val}`
instructions is decided based on the AIR block they exist within. This
is a much more robust system, and also results in a huge drop in ZIR
bytes - around 7% for Sema.zig.
This required some enhancements to Sema to prevent elision of blocks
when they are required for debug variable scoping. This can be observed
by looking at the AIR for the following simple test program with and
without `-fstrip`:
```zig
export fn f() void {
{
var a: u32 = 0;
_ = &a;
}
{
var a: u32 = 0;
_ = &a;
}
}
```
When `-fstrip` is passed, no AIR blocks are generated. When `-fno-strip`
is passed, the ZIR blocks are lowered to true AIR blocks to give correct
lexical scoping to the debug vars.
The changes here incidentally reolve #19060. A corresponding behavior
test has been added.
Resolves: #19060
Diffstat (limited to 'lib/std/zig.zig')
0 files changed, 0 insertions, 0 deletions
