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 {...@@ -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,
284282
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};
487484
...@@ -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);
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);
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);
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);
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);
src/link/C.zig-1
...@@ -126,7 +126,6 @@ pub fn updateFunc(self: *C, module: *Module, func: *Module.Fn, air: Air, livenes...@@ -126,7 +126,6 @@ pub fn updateFunc(self: *C, module: *Module, func: *Module.Fn, air: Air, livenes
126 .indent_writer = undefined, // set later so we can get a pointer to object.code126 .indent_writer = undefined, // set later so we can get a pointer to object.code
127 },127 },
128 .lazy_fns = lazy_fns.*,128 .lazy_fns = lazy_fns.*,
129 .arena = std.heap.ArenaAllocator.init(gpa),
130 };129 };
131130
132 function.object.indent_writer = .{ .underlying_writer = function.object.code.writer() };131 function.object.indent_writer = .{ .underlying_writer = function.object.code.writer() };