diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-08-04 23:51:45 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-08-05 09:56:02 -0700 |
| commit | 196e36bbb27b0f0ebd7cd7a866b85f477b3662fb (patch) | |
| tree | 04efce99fc296278385acbd0a27acdb52d916358 /src/Compilation.zig | |
| parent | c47ec4f3d7a6bf79be3adcffa33aa51bcc26ed0b (diff) | |
| download | zig-196e36bbb27b0f0ebd7cd7a866b85f477b3662fb.tar.gz zig-196e36bbb27b0f0ebd7cd7a866b85f477b3662fb.zip | |
std: remove BoundedArray
This use case is handled by ArrayListUnmanaged via the "...Bounded"
method variants, and it's more optimal to share machine code, versus
generating multiple versions of each function for differing array
lengths.
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 419c56019f..4024e0a49e 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2103,6 +2103,8 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil .local_zir_cache = local_zir_cache, .error_limit = error_limit, .llvm_object = null, + .analysis_roots_buffer = undefined, + .analysis_roots_len = 0, }; try zcu.init(options.thread_pool.getIdCount()); break :blk zcu; @@ -2933,22 +2935,26 @@ pub fn update(comp: *Compilation, main_progress_node: std.Progress.Node) !void { try comp.appendFileSystemInput(embed_file.path); } - zcu.analysis_roots.clear(); + zcu.analysis_roots_len = 0; - zcu.analysis_roots.appendAssumeCapacity(zcu.std_mod); + zcu.analysis_roots_buffer[zcu.analysis_roots_len] = zcu.std_mod; + zcu.analysis_roots_len += 1; // Normally we rely on importing std to in turn import the root source file in the start code. // However, the main module is distinct from the root module in tests, so that won't happen there. if (comp.config.is_test and zcu.main_mod != zcu.std_mod) { - zcu.analysis_roots.appendAssumeCapacity(zcu.main_mod); + zcu.analysis_roots_buffer[zcu.analysis_roots_len] = zcu.main_mod; + zcu.analysis_roots_len += 1; } if (zcu.root_mod.deps.get("compiler_rt")) |compiler_rt_mod| { - zcu.analysis_roots.appendAssumeCapacity(compiler_rt_mod); + zcu.analysis_roots_buffer[zcu.analysis_roots_len] = compiler_rt_mod; + zcu.analysis_roots_len += 1; } if (zcu.root_mod.deps.get("ubsan_rt")) |ubsan_rt_mod| { - zcu.analysis_roots.appendAssumeCapacity(ubsan_rt_mod); + zcu.analysis_roots_buffer[zcu.analysis_roots_len] = ubsan_rt_mod; + zcu.analysis_roots_len += 1; } } @@ -4745,7 +4751,7 @@ fn performAllTheWork( try zcu.flushRetryableFailures(); // It's analysis time! Queue up our initial analysis. - for (zcu.analysis_roots.slice()) |mod| { + for (zcu.analysisRoots()) |mod| { try comp.queueJob(.{ .analyze_mod = mod }); } |
