From d49979d002161515289cf212abf821590a53e0d5 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Sat, 14 Jan 2023 21:30:52 +0100 Subject: [PATCH] remove arena from ComptimeInterpreter --- src/ComptimeInterpreter.zig | 8 ++------ src/DocumentStore.zig | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/ComptimeInterpreter.zig b/src/ComptimeInterpreter.zig index ad56b17..92aefba 100644 --- a/src/ComptimeInterpreter.zig +++ b/src/ComptimeInterpreter.zig @@ -19,10 +19,7 @@ pub const ComptimeInterpreter = @This(); const log = std.log.scoped(.comptime_interpreter); -// TODO: Investigate arena - allocator: std.mem.Allocator, -arena: std.heap.ArenaAllocator, ip: InternPool = .{}, document_store: *DocumentStore, uri: DocumentStore.Uri, @@ -64,8 +61,6 @@ pub fn deinit(interpreter: *ComptimeInterpreter) void { } interpreter.namespaces.deinit(interpreter.allocator); interpreter.decls.deinit(interpreter.allocator); - - interpreter.arena.deinit(); } pub const Type = struct { @@ -241,6 +236,7 @@ pub fn interpret( const container_namespace = @intToEnum(NamespaceIndex, interpreter.namespaces.len - 1); var fields = std.ArrayListUnmanaged(InternPool.Struct.Field){}; + defer fields.deinit(interpreter.allocator); var buffer: [2]Ast.Node.Index = undefined; const members = ast.declMembers(tree, node_idx, &buffer); @@ -274,7 +270,7 @@ pub fn interpret( .is_comptime = false, // TODO }; - try fields.append(interpreter.arena.allocator(), field); + try fields.append(interpreter.allocator, field); } const struct_type = try interpreter.ip.get(interpreter.allocator, IPKey{ diff --git a/src/DocumentStore.zig b/src/DocumentStore.zig index f8d4a15..31257ee 100644 --- a/src/DocumentStore.zig +++ b/src/DocumentStore.zig @@ -958,7 +958,6 @@ pub fn ensureInterpreterExists(self: *DocumentStore, uri: Uri) !void { var int = try self.allocator.create(ComptimeInterpreter); int.* = ComptimeInterpreter{ .allocator = self.allocator, - .arena = std.heap.ArenaAllocator.init(self.allocator), .document_store = self, .uri = uri, };