| ... | @@ -279,8 +279,6 @@ pub const Function = struct { | ... | @@ -279,8 +279,6 @@ pub const Function = struct { |
| 279 | /// by type alignment. | 279 | /// by type alignment. |
| 280 | /// The value is whether the alloc needs to be emitted in the header. | 280 | /// The value is whether the alloc needs to be emitted in the header. |
| 281 | allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .{}, | 281 | allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .{}, |
| 282 | /// Needed for memory used by the keys of free_locals_map entries. | | |
| 283 | arena: std.heap.ArenaAllocator, | | |
| 284 | | 282 | |
| 285 | fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue { | 283 | fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue { |
| 286 | if (Air.refToIndex(ref)) |inst| { | 284 | if (Air.refToIndex(ref)) |inst| { |
| ... | @@ -481,7 +479,6 @@ pub const Function = struct { | ... | @@ -481,7 +479,6 @@ pub const Function = struct { |
| 481 | f.object.code.deinit(); | 479 | f.object.code.deinit(); |
| 482 | f.object.dg.ctypes.deinit(gpa); | 480 | f.object.dg.ctypes.deinit(gpa); |
| 483 | f.object.dg.fwd_decl.deinit(); | 481 | f.object.dg.fwd_decl.deinit(); |
| 484 | f.arena.deinit(); | | |
| 485 | } | 482 | } |
| 486 | }; | 483 | }; |
| 487 | | 484 | |
| ... | @@ -3396,7 +3393,7 @@ fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { | ... | @@ -3396,7 +3393,7 @@ fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue { |
| 3396 | var deref = is_ptr; | 3393 | var deref = is_ptr; |
| 3397 | const is_array = lowersToArray(ret_ty, target); | 3394 | const is_array = lowersToArray(ret_ty, target); |
| 3398 | const ret_val = if (is_array) ret_val: { | 3395 | const ret_val = if (is_array) ret_val: { |
| 3399 | const array_local = try f.allocLocal(inst, try lowered_ret_ty.copy(f.arena.allocator())); | 3396 | const array_local = try f.allocLocal(inst, lowered_ret_ty); |
| 3400 | try writer.writeAll("memcpy("); | 3397 | try writer.writeAll("memcpy("); |
| 3401 | try f.writeCValueMember(writer, array_local, .{ .identifier = "array" }); | 3398 | try f.writeCValueMember(writer, array_local, .{ .identifier = "array" }); |
| 3402 | try writer.writeAll(", "); | 3399 | try writer.writeAll(", "); |
| ... | @@ -4113,7 +4110,7 @@ fn airCall( | ... | @@ -4113,7 +4110,7 @@ fn airCall( |
| 4113 | var lowered_arg_buf: LowerFnRetTyBuffer = undefined; | 4110 | var lowered_arg_buf: LowerFnRetTyBuffer = undefined; |
| 4114 | const lowered_arg_ty = lowerFnRetTy(arg_ty, &lowered_arg_buf, target); | 4111 | const lowered_arg_ty = lowerFnRetTy(arg_ty, &lowered_arg_buf, target); |
| 4115 | | 4112 | |
| 4116 | const array_local = try f.allocLocal(inst, try lowered_arg_ty.copy(f.arena.allocator())); | 4113 | const array_local = try f.allocLocal(inst, lowered_arg_ty); |
| 4117 | try writer.writeAll("memcpy("); | 4114 | try writer.writeAll("memcpy("); |
| 4118 | try f.writeCValueMember(writer, array_local, .{ .identifier = "array" }); | 4115 | try f.writeCValueMember(writer, array_local, .{ .identifier = "array" }); |
| 4119 | try writer.writeAll(", "); | 4116 | try writer.writeAll(", "); |
| ... | @@ -4156,7 +4153,7 @@ fn airCall( | ... | @@ -4156,7 +4153,7 @@ fn airCall( |
| 4156 | try writer.writeByte(')'); | 4153 | try writer.writeByte(')'); |
| 4157 | break :result .none; | 4154 | break :result .none; |
| 4158 | } else { | 4155 | } else { |
| 4159 | const local = try f.allocLocal(inst, try lowered_ret_ty.copy(f.arena.allocator())); | 4156 | const local = try f.allocLocal(inst, lowered_ret_ty); |
| 4160 | try f.writeCValue(writer, local, .Other); | 4157 | try f.writeCValue(writer, local, .Other); |
| 4161 | try writer.writeAll(" = "); | 4158 | try writer.writeAll(" = "); |
| 4162 | break :result local; | 4159 | break :result local; |
| ... | @@ -5363,7 +5360,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -5363,7 +5360,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { |
| 5363 | }; | 5360 | }; |
| 5364 | const field_int_ty = Type.initPayload(&field_int_pl.base); | 5361 | const field_int_ty = Type.initPayload(&field_int_pl.base); |
| 5365 | | 5362 | |
| 5366 | const temp_local = try f.allocLocal(inst, try field_int_ty.copy(f.arena.allocator())); | 5363 | const temp_local = try f.allocLocal(inst, field_int_ty); |
| 5367 | try f.writeCValue(writer, temp_local, .Other); | 5364 | try f.writeCValue(writer, temp_local, .Other); |
| 5368 | try writer.writeAll(" = zig_wrap_"); | 5365 | try writer.writeAll(" = zig_wrap_"); |
| 5369 | try f.object.dg.renderTypeForBuiltinFnName(writer, field_int_ty); | 5366 | try f.object.dg.renderTypeForBuiltinFnName(writer, field_int_ty); |