authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-17 16:36:44-05:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2024-12-17 16:37:04-05:00
log2bb05f0ee7d545af1de5269e9a0d3aac59eb3f12
tree08e71a9eecf479706dc269d854048326b29337c1
parentdebba652a3f5af76840517321d389a2ec98a88f4

Dwarf: fix data races by reading from ZIR


1 files changed, 7 insertions(+), 18 deletions(-)

src/link/Dwarf.zig+7-18
...@@ -2277,12 +2277,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2277,12 +2277,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2277 => DW.ACCESS.private,2277 => DW.ACCESS.private,
2278 _ => if (decl_extra.name.isNamedTest(file.zir))2278 _ => if (decl_extra.name.isNamedTest(file.zir))
2279 DW.ACCESS.private2279 DW.ACCESS.private
2280 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))2280 else if (decl_extra.flags.is_pub)
2281 DW.ACCESS.public2281 DW.ACCESS.public
2282 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2283 DW.ACCESS.private
2284 else2282 else
2285 unreachable,2283 DW.ACCESS.private,
2286 },2284 },
2287 };2285 };
2288 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };2286 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
...@@ -2326,12 +2324,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2326,12 +2324,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2326 => DW.ACCESS.private,2324 => DW.ACCESS.private,
2327 _ => if (decl_extra.name.isNamedTest(file.zir))2325 _ => if (decl_extra.name.isNamedTest(file.zir))
2328 DW.ACCESS.private2326 DW.ACCESS.private
2329 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))2327 else if (decl_extra.flags.is_pub)
2330 DW.ACCESS.public2328 DW.ACCESS.public
2331 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2332 DW.ACCESS.private
2333 else2329 else
2334 unreachable,2330 DW.ACCESS.private,
2335 },2331 },
2336 };2332 };
2337 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };2333 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
...@@ -2373,12 +2369,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In...@@ -2373,12 +2369,10 @@ pub fn initWipNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool.Nav.In
2373 => DW.ACCESS.private,2369 => DW.ACCESS.private,
2374 _ => if (decl_extra.name.isNamedTest(file.zir))2370 _ => if (decl_extra.name.isNamedTest(file.zir))
2375 DW.ACCESS.private2371 DW.ACCESS.private
2376 else if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))2372 else if (decl_extra.flags.is_pub)
2377 DW.ACCESS.public2373 DW.ACCESS.public
2378 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2379 DW.ACCESS.private
2380 else2374 else
2381 unreachable,2375 DW.ACCESS.private,
2382 },2376 },
2383 };2377 };
2384 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };2378 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
...@@ -2624,12 +2618,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool...@@ -2624,12 +2618,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2624 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);2618 const parent_namespace_ptr = ip.namespacePtr(ip.getCau(cau).namespace);
2625 break :parent .{2619 break :parent .{
2626 parent_namespace_ptr.owner_type,2620 parent_namespace_ptr.owner_type,
2627 if (parent_namespace_ptr.pub_decls.containsContext(nav_index, .{ .zcu = zcu }))2621 if (decl_extra.data.flags.is_pub) DW.ACCESS.public else DW.ACCESS.private,
2628 DW.ACCESS.public
2629 else if (parent_namespace_ptr.priv_decls.containsContext(nav_index, .{ .zcu = zcu }))
2630 DW.ACCESS.private
2631 else
2632 unreachable,
2633 };2622 };
2634 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };2623 } else .{ zcu.fileRootType(inst_info.file), DW.ACCESS.private };
26352624