Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dwarf: preserve deduped struct navs #22252

Merged
merged 4 commits into from
Dec 17, 2024

Conversation

jacobly0
Copy link
Member

@jacobly0 jacobly0 commented Dec 16, 2024

fn Foo(comptime T: type) type {
    return struct {
        x: T,
        const Bar = struct { x: u32 };
    };
}
pub fn main() void {
    var foo1: Foo(u32) = .{ .x = 1 };
    var foo2: Foo(bool) = .{ .x = false };
    _ = .{ &foo1, &foo2, @TypeOf(foo1).Bar, @TypeOf(foo2).Bar };
    @breakpoint();
}
(lldb) p @TypeOf(foo1)
(type) struct {}
(lldb) p @TypeOf(foo2)
(type) struct {
  Bar = struct {}
}

(lldb) p @TypeOf(foo1)
(type) struct {
  Bar = struct {}
}
(lldb) p @TypeOf(foo2)
(type) struct {
  Bar = repro.repro.Foo(u32).Bar
}

Also, start porting stage2 pretty printers to self-hosted debug info and thread-safe internpool changes.

Previously, if multiple navs owned the same type due to being the same
zir node and having the same captures, they would overwrite each other.
Now, the navs codegenned later emit a decl alias to the first one.
@jacobly0 jacobly0 force-pushed the dwarf-deduped-structs branch from 8542b23 to 238750a Compare December 16, 2024 21:46
@jacobly0 jacobly0 force-pushed the dwarf-deduped-structs branch from 238750a to 8c0628d Compare December 16, 2024 22:26
@andrewrk andrewrk merged commit debba65 into ziglang:master Dec 17, 2024
10 checks passed
@jacobly0 jacobly0 deleted the dwarf-deduped-structs branch December 17, 2024 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants