authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2023-06-01 08:10:45+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-06-10 20:47:58-07:00
log9b48fc2833be409902f4d3256d2d921f4f924e0d
tree17281521b79b188aba2605b25894bc066d24e065
parentcab79b0877e9e7239045dc55d3b2bcff190016cb

Allocate capture scopes in gpa instead of Decl.value_arena

This eliminates the last major use of value_arena, in preparation to remove it.

2 files changed, 101 insertions(+), 66 deletions(-)

src/Module.zig+46-30
...@@ -277,61 +277,75 @@ pub const Export = struct {...@@ -277,61 +277,75 @@ pub const Export = struct {
277};277};
278278
279pub const CaptureScope = struct {279pub const CaptureScope = struct {
280 refs: u32,
280 parent: ?*CaptureScope,281 parent: ?*CaptureScope,
281282
282 /// Values from this decl's evaluation that will be closed over in283 /// Values from this decl's evaluation that will be closed over in
283 /// child decls. Values stored in the value_arena of the linked decl.284 /// child decls. This map is backed by the gpa, and deinited when
284 /// During sema, this map is backed by the gpa. Once sema completes,285 /// the refcount reaches 0.
285 /// it is reallocated using the value_arena.286 captures: std.AutoHashMapUnmanaged(Zir.Inst.Index, Capture) = .{},
286 captures: std.AutoHashMapUnmanaged(Zir.Inst.Index, TypedValue) = .{},
287287
288 pub fn failed(noalias self: *const @This()) bool {288 pub const Capture = union(enum) {
289 comptime_val: InternPool.Index, // index of value
290 runtime_val: InternPool.Index, // index of type
291 };
292
293 pub fn failed(noalias self: *const CaptureScope) bool {
289 return self.captures.available == 0 and self.captures.size == std.math.maxInt(u32);294 return self.captures.available == 0 and self.captures.size == std.math.maxInt(u32);
290 }295 }
291296
292 pub fn fail(noalias self: *@This()) void {297 pub fn fail(noalias self: *CaptureScope, gpa: Allocator) void {
298 self.captures.deinit(gpa);
293 self.captures.available = 0;299 self.captures.available = 0;
294 self.captures.size = std.math.maxInt(u32);300 self.captures.size = std.math.maxInt(u32);
295 }301 }
302
303 pub fn incRef(self: *CaptureScope) void {
304 self.refs += 1;
305 }
306
307 pub fn decRef(self: *CaptureScope, gpa: Allocator) void {
308 self.refs -= 1;
309 if (self.refs > 0) return;
310 if (self.parent) |p| p.decRef(gpa);
311 if (!self.failed()) {
312 self.captures.deinit(gpa);
313 }
314 }
296};315};
297316
298pub const WipCaptureScope = struct {317pub const WipCaptureScope = struct {
299 scope: *CaptureScope,318 scope: *CaptureScope,
300 finalized: bool,319 finalized: bool,
301 gpa: Allocator,320 gpa: Allocator,
302 perm_arena: Allocator,
303321
304 pub fn init(gpa: Allocator, perm_arena: Allocator, parent: ?*CaptureScope) !@This() {322 pub fn init(gpa: Allocator, parent: ?*CaptureScope) !WipCaptureScope {
305 const scope = try perm_arena.create(CaptureScope);323 const scope = try gpa.create(CaptureScope);
306 scope.* = .{ .parent = parent };324 if (parent) |p| p.incRef();
307 return @This(){325 scope.* = .{ .refs = 1, .parent = parent };
326 return .{
308 .scope = scope,327 .scope = scope,
309 .finalized = false,328 .finalized = false,
310 .gpa = gpa,329 .gpa = gpa,
311 .perm_arena = perm_arena,
312 };330 };
313 }331 }
314332
315 pub fn finalize(noalias self: *@This()) !void {333 pub fn finalize(noalias self: *WipCaptureScope) !void {
316 assert(!self.finalized);
317 // use a temp to avoid unintentional aliasing due to RLS
318 const tmp = try self.scope.captures.clone(self.perm_arena);
319 self.scope.captures.deinit(self.gpa);
320 self.scope.captures = tmp;
321 self.finalized = true;334 self.finalized = true;
322 }335 }
323336
324 pub fn reset(noalias self: *@This(), parent: ?*CaptureScope) !void {337 pub fn reset(noalias self: *WipCaptureScope, parent: ?*CaptureScope) !void {
325 if (!self.finalized) try self.finalize();338 self.scope.decRef(self.gpa);
326 self.scope = try self.perm_arena.create(CaptureScope);339 self.scope = try self.gpa.create(CaptureScope);
327 self.scope.* = .{ .parent = parent };340 if (parent) |p| p.incRef();
328 self.finalized = false;341 self.scope.* = .{ .refs = 1, .parent = parent };
329 }342 }
330343
331 pub fn deinit(noalias self: *@This()) void {344 pub fn deinit(noalias self: *WipCaptureScope) void {
332 if (!self.finalized) {345 if (self.finalized) {
333 self.scope.captures.deinit(self.gpa);346 self.scope.decRef(self.gpa);
334 self.scope.fail();347 } else {
348 self.scope.fail(self.gpa);
335 }349 }
336 self.* = undefined;350 self.* = undefined;
337 }351 }
...@@ -3311,6 +3325,7 @@ pub fn destroyDecl(mod: *Module, decl_index: Decl.Index) void {...@@ -3311,6 +3325,7 @@ pub fn destroyDecl(mod: *Module, decl_index: Decl.Index) void {
3311 mod.destroyNamespace(i);3325 mod.destroyNamespace(i);
3312 }3326 }
3313 }3327 }
3328 if (decl.src_scope) |scope| scope.decRef(gpa);
3314 decl.clearValues(mod);3329 decl.clearValues(mod);
3315 decl.dependants.deinit(gpa);3330 decl.dependants.deinit(gpa);
3316 decl.dependencies.deinit(gpa);3331 decl.dependencies.deinit(gpa);
...@@ -4425,7 +4440,7 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void {...@@ -4425,7 +4440,7 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void {
4425 };4440 };
4426 defer sema.deinit();4441 defer sema.deinit();
44274442
4428 var wip_captures = try WipCaptureScope.init(gpa, new_decl_arena_allocator, null);4443 var wip_captures = try WipCaptureScope.init(gpa, null);
4429 defer wip_captures.deinit();4444 defer wip_captures.deinit();
44304445
4431 if (sema.analyzeStructDecl(new_decl, main_struct_inst, struct_index)) |_| {4446 if (sema.analyzeStructDecl(new_decl, main_struct_inst, struct_index)) |_| {
...@@ -4538,7 +4553,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {...@@ -4538,7 +4553,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool {
4538 }4553 }
4539 log.debug("semaDecl {*} ({s})", .{ decl, decl.name });4554 log.debug("semaDecl {*} ({s})", .{ decl, decl.name });
45404555
4541 var wip_captures = try WipCaptureScope.init(gpa, decl_arena_allocator, decl.src_scope);4556 var wip_captures = try WipCaptureScope.init(gpa, decl.src_scope);
4542 defer wip_captures.deinit();4557 defer wip_captures.deinit();
45434558
4544 var block_scope: Sema.Block = .{4559 var block_scope: Sema.Block = .{
...@@ -5499,7 +5514,7 @@ pub fn analyzeFnBody(mod: *Module, func_index: Fn.Index, arena: Allocator) SemaE...@@ -5499,7 +5514,7 @@ pub fn analyzeFnBody(mod: *Module, func_index: Fn.Index, arena: Allocator) SemaE
5499 try sema.air_extra.ensureTotalCapacity(gpa, reserved_count);5514 try sema.air_extra.ensureTotalCapacity(gpa, reserved_count);
5500 sema.air_extra.items.len += reserved_count;5515 sema.air_extra.items.len += reserved_count;
55015516
5502 var wip_captures = try WipCaptureScope.init(gpa, decl_arena_allocator, decl.src_scope);5517 var wip_captures = try WipCaptureScope.init(gpa, decl.src_scope);
5503 defer wip_captures.deinit();5518 defer wip_captures.deinit();
55045519
5505 var inner_block: Sema.Block = .{5520 var inner_block: Sema.Block = .{
...@@ -5771,6 +5786,7 @@ pub fn allocateNewDecl(...@@ -5771,6 +5786,7 @@ pub fn allocateNewDecl(
5771 };5786 };
5772 };5787 };
57735788
5789 if (src_scope) |scope| scope.incRef();
5774 decl_and_index.new_decl.* = .{5790 decl_and_index.new_decl.* = .{
5775 .name = undefined,5791 .name = undefined,
5776 .src_namespace = namespace,5792 .src_namespace = namespace,
src/Sema.zig+55-36
...@@ -889,17 +889,18 @@ fn analyzeBodyInner(...@@ -889,17 +889,18 @@ fn analyzeBodyInner(
889889
890 try sema.inst_map.ensureSpaceForInstructions(sema.gpa, body);890 try sema.inst_map.ensureSpaceForInstructions(sema.gpa, body);
891891
892 // Most of the time, we don't need to construct a new capture scope for a
893 // block. However, successive iterations of comptime loops can capture
894 // different values for the same Zir.Inst.Index, so in those cases, we will
895 // have to create nested capture scopes; see the `.repeat` case below.
892 const parent_capture_scope = block.wip_capture_scope;896 const parent_capture_scope = block.wip_capture_scope;
893897 parent_capture_scope.incRef();
894 var wip_captures = WipCaptureScope{898 var wip_captures: WipCaptureScope = .{
895 .finalized = true,
896 .scope = parent_capture_scope,899 .scope = parent_capture_scope,
897 .perm_arena = sema.perm_arena,
898 .gpa = sema.gpa,900 .gpa = sema.gpa,
901 .finalized = true, // don't finalize the parent scope
899 };902 };
900 defer if (wip_captures.scope != parent_capture_scope) {903 defer wip_captures.deinit();
901 wip_captures.deinit();
902 };
903904
904 const mod = sema.mod;905 const mod = sema.mod;
905 const map = &sema.inst_map;906 const map = &sema.inst_map;
...@@ -1452,6 +1453,11 @@ fn analyzeBodyInner(...@@ -1452,6 +1453,11 @@ fn analyzeBodyInner(
1452 const src = LazySrcLoc.nodeOffset(datas[inst].node);1453 const src = LazySrcLoc.nodeOffset(datas[inst].node);
1453 try sema.emitBackwardBranch(block, src);1454 try sema.emitBackwardBranch(block, src);
1454 if (wip_captures.scope.captures.count() != orig_captures) {1455 if (wip_captures.scope.captures.count() != orig_captures) {
1456 // We need to construct new capture scopes for the next loop iteration so it
1457 // can capture values without clobbering the earlier iteration's captures.
1458 // At first, we reused the parent capture scope as an optimization, but for
1459 // successive scopes we have to create new ones as children of the parent
1460 // scope.
1455 try wip_captures.reset(parent_capture_scope);1461 try wip_captures.reset(parent_capture_scope);
1456 block.wip_capture_scope = wip_captures.scope;1462 block.wip_capture_scope = wip_captures.scope;
1457 orig_captures = 0;1463 orig_captures = 0;
...@@ -1467,6 +1473,11 @@ fn analyzeBodyInner(...@@ -1467,6 +1473,11 @@ fn analyzeBodyInner(
1467 const src = LazySrcLoc.nodeOffset(datas[inst].node);1473 const src = LazySrcLoc.nodeOffset(datas[inst].node);
1468 try sema.emitBackwardBranch(block, src);1474 try sema.emitBackwardBranch(block, src);
1469 if (wip_captures.scope.captures.count() != orig_captures) {1475 if (wip_captures.scope.captures.count() != orig_captures) {
1476 // We need to construct new capture scopes for the next loop iteration so it
1477 // can capture values without clobbering the earlier iteration's captures.
1478 // At first, we reused the parent capture scope as an optimization, but for
1479 // successive scopes we have to create new ones as children of the parent
1480 // scope.
1470 try wip_captures.reset(parent_capture_scope);1481 try wip_captures.reset(parent_capture_scope);
1471 block.wip_capture_scope = wip_captures.scope;1482 block.wip_capture_scope = wip_captures.scope;
1472 orig_captures = 0;1483 orig_captures = 0;
...@@ -1749,6 +1760,8 @@ fn analyzeBodyInner(...@@ -1749,6 +1760,8 @@ fn analyzeBodyInner(
1749 if (noreturn_inst) |some| try block.instructions.append(sema.gpa, some);1760 if (noreturn_inst) |some| try block.instructions.append(sema.gpa, some);
17501761
1751 if (!wip_captures.finalized) {1762 if (!wip_captures.finalized) {
1763 // We've updated the capture scope due to a `repeat` instruction where
1764 // the body had a capture; finalize our child scope and reset
1752 try wip_captures.finalize();1765 try wip_captures.finalize();
1753 block.wip_capture_scope = parent_capture_scope;1766 block.wip_capture_scope = parent_capture_scope;
1754 }1767 }
...@@ -3007,7 +3020,7 @@ fn zirEnumDecl(...@@ -3007,7 +3020,7 @@ fn zirEnumDecl(
3007 defer sema.func = prev_func;3020 defer sema.func = prev_func;
3008 defer sema.func_index = prev_func_index;3021 defer sema.func_index = prev_func_index;
30093022
3010 var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, new_decl.src_scope);3023 var wip_captures = try WipCaptureScope.init(gpa, new_decl.src_scope);
3011 defer wip_captures.deinit();3024 defer wip_captures.deinit();
30123025
3013 var enum_block: Block = .{3026 var enum_block: Block = .{
...@@ -6888,7 +6901,7 @@ fn analyzeCall(...@@ -6888,7 +6901,7 @@ fn analyzeCall(
6888 sema.error_return_trace_index_on_fn_entry = block.error_return_trace_index;6901 sema.error_return_trace_index_on_fn_entry = block.error_return_trace_index;
6889 defer sema.error_return_trace_index_on_fn_entry = parent_err_ret_index;6902 defer sema.error_return_trace_index_on_fn_entry = parent_err_ret_index;
68906903
6891 var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, fn_owner_decl.src_scope);6904 var wip_captures = try WipCaptureScope.init(gpa, fn_owner_decl.src_scope);
6892 defer wip_captures.deinit();6905 defer wip_captures.deinit();
68936906
6894 var child_block: Block = .{6907 var child_block: Block = .{
...@@ -7751,7 +7764,7 @@ fn resolveGenericInstantiationType(...@@ -7751,7 +7764,7 @@ fn resolveGenericInstantiationType(
7751 };7764 };
7752 defer child_sema.deinit();7765 defer child_sema.deinit();
77537766
7754 var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, new_decl.src_scope);7767 var wip_captures = try WipCaptureScope.init(gpa, new_decl.src_scope);
7755 defer wip_captures.deinit();7768 defer wip_captures.deinit();
77567769
7757 var child_block: Block = .{7770 var child_block: Block = .{
...@@ -11151,7 +11164,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -11151,7 +11164,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
11151 const body = sema.code.extra[extra_index..][0..body_len];11164 const body = sema.code.extra[extra_index..][0..body_len];
11152 extra_index += body_len;11165 extra_index += body_len;
1115311166
11154 var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, child_block.wip_capture_scope);11167 var wip_captures = try WipCaptureScope.init(gpa, child_block.wip_capture_scope);
11155 defer wip_captures.deinit();11168 defer wip_captures.deinit();
1115611169
11157 case_block.instructions.shrinkRetainingCapacity(0);11170 case_block.instructions.shrinkRetainingCapacity(0);
...@@ -11396,7 +11409,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -11396,7 +11409,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
11396 var cond_body = try case_block.instructions.toOwnedSlice(gpa);11409 var cond_body = try case_block.instructions.toOwnedSlice(gpa);
11397 defer gpa.free(cond_body);11410 defer gpa.free(cond_body);
1139811411
11399 var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, child_block.wip_capture_scope);11412 var wip_captures = try WipCaptureScope.init(gpa, child_block.wip_capture_scope);
11400 defer wip_captures.deinit();11413 defer wip_captures.deinit();
1140111414
11402 case_block.instructions.shrinkRetainingCapacity(0);11415 case_block.instructions.shrinkRetainingCapacity(0);
...@@ -11577,7 +11590,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -11577,7 +11590,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
11577 }),11590 }),
11578 };11591 };
1157911592
11580 var wip_captures = try WipCaptureScope.init(gpa, sema.perm_arena, child_block.wip_capture_scope);11593 var wip_captures = try WipCaptureScope.init(gpa, child_block.wip_capture_scope);
11581 defer wip_captures.deinit();11594 defer wip_captures.deinit();
1158211595
11583 case_block.instructions.shrinkRetainingCapacity(0);11596 case_block.instructions.shrinkRetainingCapacity(0);
...@@ -15720,13 +15733,15 @@ fn zirClosureCapture(...@@ -15720,13 +15733,15 @@ fn zirClosureCapture(
15720 // ...in which case the closure_capture instruction has access to a runtime15733 // ...in which case the closure_capture instruction has access to a runtime
15721 // value only. In such case we preserve the type and use a dummy runtime value.15734 // value only. In such case we preserve the type and use a dummy runtime value.
15722 const operand = try sema.resolveInst(inst_data.operand);15735 const operand = try sema.resolveInst(inst_data.operand);
15723 const val = (try sema.resolveMaybeUndefValAllowVariables(operand)) orelse15736 const ty = sema.typeOf(operand);
15724 Value.@"unreachable";15737 const capture: CaptureScope.Capture = blk: {
1572515738 if (try sema.resolveMaybeUndefValAllowVariables(operand)) |val| {
15726 try block.wip_capture_scope.captures.putNoClobber(sema.gpa, inst, .{15739 const ip_index = try val.intern(ty, sema.mod);
15727 .ty = sema.typeOf(operand),15740 break :blk .{ .comptime_val = ip_index };
15728 .val = try val.copy(sema.perm_arena),15741 }
15729 });15742 break :blk .{ .runtime_val = ty.toIntern() };
15743 };
15744 try block.wip_capture_scope.captures.putNoClobber(sema.gpa, inst, capture);
15730}15745}
1573115746
15732fn zirClosureGet(15747fn zirClosureGet(
...@@ -15740,7 +15755,7 @@ fn zirClosureGet(...@@ -15740,7 +15755,7 @@ fn zirClosureGet(
15740 var scope: *CaptureScope = mod.declPtr(block.src_decl).src_scope.?;15755 var scope: *CaptureScope = mod.declPtr(block.src_decl).src_scope.?;
15741 // Note: The target closure must be in this scope list.15756 // Note: The target closure must be in this scope list.
15742 // If it's not here, the zir is invalid, or the list is broken.15757 // If it's not here, the zir is invalid, or the list is broken.
15743 const tv = while (true) {15758 const capture = while (true) {
15744 // Note: We don't need to add a dependency here, because15759 // Note: We don't need to add a dependency here, because
15745 // decls always depend on their lexical parents.15760 // decls always depend on their lexical parents.
1574615761
...@@ -15753,13 +15768,13 @@ fn zirClosureGet(...@@ -15753,13 +15768,13 @@ fn zirClosureGet(
15753 }15768 }
15754 return error.AnalysisFail;15769 return error.AnalysisFail;
15755 }15770 }
15756 if (scope.captures.getPtr(inst_data.inst)) |tv| {15771 if (scope.captures.get(inst_data.inst)) |capture| {
15757 break tv;15772 break capture;
15758 }15773 }
15759 scope = scope.parent.?;15774 scope = scope.parent.?;
15760 };15775 };
1576115776
15762 if (tv.val.toIntern() == .unreachable_value and !block.is_typeof and sema.func_index == .none) {15777 if (capture == .runtime_val and !block.is_typeof and sema.func_index == .none) {
15763 const msg = msg: {15778 const msg = msg: {
15764 const name = name: {15779 const name = name: {
15765 const file = sema.owner_decl.getFileScope(mod);15780 const file = sema.owner_decl.getFileScope(mod);
...@@ -15787,7 +15802,7 @@ fn zirClosureGet(...@@ -15787,7 +15802,7 @@ fn zirClosureGet(
15787 return sema.failWithOwnedErrorMsg(msg);15802 return sema.failWithOwnedErrorMsg(msg);
15788 }15803 }
1578915804
15790 if (tv.val.toIntern() == .unreachable_value and !block.is_typeof and !block.is_comptime and sema.func_index != .none) {15805 if (capture == .runtime_val and !block.is_typeof and !block.is_comptime and sema.func_index != .none) {
15791 const msg = msg: {15806 const msg = msg: {
15792 const name = name: {15807 const name = name: {
15793 const file = sema.owner_decl.getFileScope(mod);15808 const file = sema.owner_decl.getFileScope(mod);
...@@ -15817,13 +15832,17 @@ fn zirClosureGet(...@@ -15817,13 +15832,17 @@ fn zirClosureGet(
15817 return sema.failWithOwnedErrorMsg(msg);15832 return sema.failWithOwnedErrorMsg(msg);
15818 }15833 }
1581915834
15820 if (tv.val.toIntern() == .unreachable_value) {15835 switch (capture) {
15821 assert(block.is_typeof);15836 .runtime_val => |ty_ip_index| {
15822 // We need a dummy runtime instruction with the correct type.15837 assert(block.is_typeof);
15823 return block.addTy(.alloc, tv.ty);15838 // We need a dummy runtime instruction with the correct type.
15839 return block.addTy(.alloc, ty_ip_index.toType());
15840 },
15841 .comptime_val => |val_ip_index| {
15842 const ty = mod.intern_pool.typeOf(val_ip_index).toType();
15843 return sema.addConstant(ty, val_ip_index.toValue());
15844 },
15824 }15845 }
15825
15826 return sema.addConstant(tv.ty, tv.val);
15827}15846}
1582815847
15829fn zirRetAddr(15848fn zirRetAddr(
...@@ -31838,7 +31857,7 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi...@@ -31838,7 +31857,7 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi
31838 var sema: Sema = .{ .mod = mod, .gpa = gpa, .arena = analysis_arena.allocator(), .perm_arena = decl_arena_allocator, .code = zir, .owner_decl = decl, .owner_decl_index = decl_index, .func = null, .func_index = .none, .fn_ret_ty = Type.void, .owner_func = null, .owner_func_index = .none };31857 var sema: Sema = .{ .mod = mod, .gpa = gpa, .arena = analysis_arena.allocator(), .perm_arena = decl_arena_allocator, .code = zir, .owner_decl = decl, .owner_decl_index = decl_index, .func = null, .func_index = .none, .fn_ret_ty = Type.void, .owner_func = null, .owner_func_index = .none };
31839 defer sema.deinit();31858 defer sema.deinit();
3184031859
31841 var wip_captures = try WipCaptureScope.init(gpa, decl_arena_allocator, decl.src_scope);31860 var wip_captures = try WipCaptureScope.init(gpa, decl.src_scope);
31842 defer wip_captures.deinit();31861 defer wip_captures.deinit();
3184331862
31844 var block: Block = .{31863 var block: Block = .{
...@@ -32591,7 +32610,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void...@@ -32591,7 +32610,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void
32591 };32610 };
32592 defer sema.deinit();32611 defer sema.deinit();
3259332612
32594 var wip_captures = try WipCaptureScope.init(gpa, decl_arena_allocator, decl.src_scope);32613 var wip_captures = try WipCaptureScope.init(gpa, decl.src_scope);
32595 defer wip_captures.deinit();32614 defer wip_captures.deinit();
3259632615
32597 var block_scope: Block = .{32616 var block_scope: Block = .{
...@@ -32933,7 +32952,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void {...@@ -32933,7 +32952,7 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void {
32933 };32952 };
32934 defer sema.deinit();32953 defer sema.deinit();
3293532954
32936 var wip_captures = try WipCaptureScope.init(gpa, decl_arena_allocator, decl.src_scope);32955 var wip_captures = try WipCaptureScope.init(gpa, decl.src_scope);
32937 defer wip_captures.deinit();32956 defer wip_captures.deinit();
3293832957
32939 var block_scope: Block = .{32958 var block_scope: Block = .{
...@@ -33360,7 +33379,7 @@ fn generateUnionTagTypeSimple(...@@ -33360,7 +33379,7 @@ fn generateUnionTagTypeSimple(
33360}33379}
3336133380
33362fn getBuiltin(sema: *Sema, name: []const u8) CompileError!Air.Inst.Ref {33381fn getBuiltin(sema: *Sema, name: []const u8) CompileError!Air.Inst.Ref {
33363 var wip_captures = try WipCaptureScope.init(sema.gpa, sema.perm_arena, sema.owner_decl.src_scope);33382 var wip_captures = try WipCaptureScope.init(sema.gpa, sema.owner_decl.src_scope);
33364 defer wip_captures.deinit();33383 defer wip_captures.deinit();
3336533384
33366 var block: Block = .{33385 var block: Block = .{
...@@ -33405,7 +33424,7 @@ fn getBuiltin(sema: *Sema, name: []const u8) CompileError!Air.Inst.Ref {...@@ -33405,7 +33424,7 @@ fn getBuiltin(sema: *Sema, name: []const u8) CompileError!Air.Inst.Ref {
33405fn getBuiltinType(sema: *Sema, name: []const u8) CompileError!Type {33424fn getBuiltinType(sema: *Sema, name: []const u8) CompileError!Type {
33406 const ty_inst = try sema.getBuiltin(name);33425 const ty_inst = try sema.getBuiltin(name);
3340733426
33408 var wip_captures = try WipCaptureScope.init(sema.gpa, sema.perm_arena, sema.owner_decl.src_scope);33427 var wip_captures = try WipCaptureScope.init(sema.gpa, sema.owner_decl.src_scope);
33409 defer wip_captures.deinit();33428 defer wip_captures.deinit();
3341033429
33411 var block: Block = .{33430 var block: Block = .{