authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-04-24 22:59:23-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2023-04-25 13:42:10-04:00
loge485d0062130e9a76f3916ff57c6740a8e7529d3
tree95e6e43a32d490396d14f1f17397c294d32bce60
parentf780a6b024f25838560cce6e0bd93c808e09457b

cbe: remove unused arena


2 files changed, 4 insertions(+), 8 deletions(-)

src/codegen/c.zig+4-7
......@@ -279,8 +279,6 @@ pub const Function = struct {
279279 /// by type alignment.
280280 /// The value is whether the alloc needs to be emitted in the header.
281281 allocs: std.AutoArrayHashMapUnmanaged(LocalIndex, bool) = .{},
282 /// Needed for memory used by the keys of free_locals_map entries.
283 arena: std.heap.ArenaAllocator,
284282
285283 fn resolveInst(f: *Function, ref: Air.Inst.Ref) !CValue {
286284 if (Air.refToIndex(ref)) |inst| {
......@@ -481,7 +479,6 @@ pub const Function = struct {
481479 f.object.code.deinit();
482480 f.object.dg.ctypes.deinit(gpa);
483481 f.object.dg.fwd_decl.deinit();
484 f.arena.deinit();
485482 }
486483};
487484
......@@ -3396,7 +3393,7 @@ fn airRet(f: *Function, inst: Air.Inst.Index, is_ptr: bool) !CValue {
33963393 var deref = is_ptr;
33973394 const is_array = lowersToArray(ret_ty, target);
33983395 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);
34003397 try writer.writeAll("memcpy(");
34013398 try f.writeCValueMember(writer, array_local, .{ .identifier = "array" });
34023399 try writer.writeAll(", ");
......@@ -4113,7 +4110,7 @@ fn airCall(
41134110 var lowered_arg_buf: LowerFnRetTyBuffer = undefined;
41144111 const lowered_arg_ty = lowerFnRetTy(arg_ty, &lowered_arg_buf, target);
41154112
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);
41174114 try writer.writeAll("memcpy(");
41184115 try f.writeCValueMember(writer, array_local, .{ .identifier = "array" });
41194116 try writer.writeAll(", ");
......@@ -4156,7 +4153,7 @@ fn airCall(
41564153 try writer.writeByte(')');
41574154 break :result .none;
41584155 } 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);
41604157 try f.writeCValue(writer, local, .Other);
41614158 try writer.writeAll(" = ");
41624159 break :result local;
......@@ -5363,7 +5360,7 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue {
53635360 };
53645361 const field_int_ty = Type.initPayload(&field_int_pl.base);
53655362
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);
53675364 try f.writeCValue(writer, temp_local, .Other);
53685365 try writer.writeAll(" = zig_wrap_");
53695366 try f.object.dg.renderTypeForBuiltinFnName(writer, field_int_ty);
src/link/C.zig-1
......@@ -126,7 +126,6 @@ pub fn updateFunc(self: *C, module: *Module, func: *Module.Fn, air: Air, livenes
126126 .indent_writer = undefined, // set later so we can get a pointer to object.code
127127 },
128128 .lazy_fns = lazy_fns.*,
129 .arena = std.heap.ArenaAllocator.init(gpa),
130129 };
131130
132131 function.object.indent_writer = .{ .underlying_writer = function.object.code.writer() };