aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorRyan Liptak <squeek502@hotmail.com>2021-11-01 00:56:55 -0700
committerRyan Liptak <squeek502@hotmail.com>2021-11-01 00:57:33 -0700
commita34375814106dbc0e0181bca7cc4ffb1821cb51e (patch)
treed618f9b7216623a8ad9b415f29dc4c9f0d6bd155 /src/Module.zig
parentf49d42729a22846ec54b6610db415ac8cdaa31db (diff)
downloadzig-a34375814106dbc0e0181bca7cc4ffb1821cb51e.tar.gz
zig-a34375814106dbc0e0181bca7cc4ffb1821cb51e.zip
Update ensureTotalCapacity to ensureTotalCapacityPrecise where it makes sense
These calls are all late-initialization of ArrayList's that were initialized outside the current scope. This allows us to still get the potential memory-saving benefits of the 'precision' of initCapacity.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 1f394a0833..c975fc1c36 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -4146,7 +4146,7 @@ pub fn analyzeFnBody(mod: *Module, decl: *Decl, func: *Fn, arena: *Allocator) Se
// for the runtime ones.
const fn_ty = decl.ty;
const runtime_params_len = @intCast(u32, fn_ty.fnParamLen());
- try inner_block.instructions.ensureTotalCapacity(gpa, runtime_params_len);
+ try inner_block.instructions.ensureTotalCapacityPrecise(gpa, runtime_params_len);
try sema.air_instructions.ensureUnusedCapacity(gpa, fn_info.total_params_len * 2); // * 2 for the `addType`
try sema.inst_map.ensureUnusedCapacity(gpa, fn_info.total_params_len);