From a1053e8e1d961ba92ce83a8ef5470ac7f7e92e60 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Thu, 11 Jul 2024 10:47:23 -0400 Subject: InternPool: add and use a mutate mutex for each list This allows the mutate mutex to only be locked during actual grows, which are rare. For the lists that didn't previously have a mutex, this change has little effect since grows are rare and there is zero contention on a mutex that is only ever locked by one thread. This change allows `extra` to be mutated without racing with a grow. --- src/Compilation.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 94ce0ee267..d48556f0e2 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -3011,7 +3011,7 @@ pub fn totalErrorCount(comp: *Compilation) u32 { } } - if (zcu.intern_pool.global_error_set.mutate.list.len > zcu.error_limit) { + if (zcu.intern_pool.global_error_set.getNamesFromMainThread().len > zcu.error_limit) { total += 1; } } @@ -3140,7 +3140,7 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle { try addModuleErrorMsg(zcu, &bundle, value.*, &all_references); } - const actual_error_count = zcu.intern_pool.global_error_set.mutate.list.len; + const actual_error_count = zcu.intern_pool.global_error_set.getNamesFromMainThread().len; if (actual_error_count > zcu.error_limit) { try bundle.addRootErrorMessage(.{ .msg = try bundle.printString("ZCU used more errors than possible: used {d}, max {d}", .{ -- cgit v1.2.3