authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-15 22:46:02-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-16 15:11:23-05:00
log74ba5762ece3029bcac4934b430dd5180f54fe1c
treeacfe57d895b2fbc5b30efd5e5425e7119a0c9917
parentd12c0bf90911339c8db0741b257eac251b827b2c

Dwarf: preserve deduped struct navs

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.

1 files changed, 4 insertions(+), 4 deletions(-)

src/link/Dwarf.zig+4-4
......@@ -2632,7 +2632,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
26322632
26332633 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
26342634 if (type_gop.found_existing) {
2635 dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).clear();
2635 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
26362636 nav_gop.value_ptr.* = type_gop.value_ptr.*;
26372637 } else {
26382638 if (nav_gop.found_existing)
......@@ -2733,7 +2733,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
27332733
27342734 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
27352735 if (type_gop.found_existing) {
2736 dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).clear();
2736 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
27372737 nav_gop.value_ptr.* = type_gop.value_ptr.*;
27382738 } else {
27392739 if (nav_gop.found_existing)
......@@ -2788,7 +2788,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
27882788
27892789 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
27902790 if (type_gop.found_existing) {
2791 dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).clear();
2791 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
27922792 nav_gop.value_ptr.* = type_gop.value_ptr.*;
27932793 } else {
27942794 if (nav_gop.found_existing)
......@@ -2879,7 +2879,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
28792879
28802880 const type_gop = try dwarf.types.getOrPut(dwarf.gpa, nav_val.toIntern());
28812881 if (type_gop.found_existing) {
2882 dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).clear();
2882 if (dwarf.debug_info.section.getUnit(wip_nav.unit).getEntry(type_gop.value_ptr.*).len > 0) break :tag .decl_alias;
28832883 nav_gop.value_ptr.* = type_gop.value_ptr.*;
28842884 } else {
28852885 if (nav_gop.found_existing)