remove arena from ComptimeInterpreter

This commit is contained in:
Techatrix 2023-01-14 21:30:52 +01:00
parent 969efdfba0
commit d49979d002
2 changed files with 2 additions and 7 deletions

View File

@ -19,10 +19,7 @@ pub const ComptimeInterpreter = @This();
const log = std.log.scoped(.comptime_interpreter); const log = std.log.scoped(.comptime_interpreter);
// TODO: Investigate arena
allocator: std.mem.Allocator, allocator: std.mem.Allocator,
arena: std.heap.ArenaAllocator,
ip: InternPool = .{}, ip: InternPool = .{},
document_store: *DocumentStore, document_store: *DocumentStore,
uri: DocumentStore.Uri, uri: DocumentStore.Uri,
@ -64,8 +61,6 @@ pub fn deinit(interpreter: *ComptimeInterpreter) void {
} }
interpreter.namespaces.deinit(interpreter.allocator); interpreter.namespaces.deinit(interpreter.allocator);
interpreter.decls.deinit(interpreter.allocator); interpreter.decls.deinit(interpreter.allocator);
interpreter.arena.deinit();
} }
pub const Type = struct { pub const Type = struct {
@ -241,6 +236,7 @@ pub fn interpret(
const container_namespace = @intToEnum(NamespaceIndex, interpreter.namespaces.len - 1); const container_namespace = @intToEnum(NamespaceIndex, interpreter.namespaces.len - 1);
var fields = std.ArrayListUnmanaged(InternPool.Struct.Field){}; var fields = std.ArrayListUnmanaged(InternPool.Struct.Field){};
defer fields.deinit(interpreter.allocator);
var buffer: [2]Ast.Node.Index = undefined; var buffer: [2]Ast.Node.Index = undefined;
const members = ast.declMembers(tree, node_idx, &buffer); const members = ast.declMembers(tree, node_idx, &buffer);
@ -274,7 +270,7 @@ pub fn interpret(
.is_comptime = false, // TODO .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{ const struct_type = try interpreter.ip.get(interpreter.allocator, IPKey{

View File

@ -958,7 +958,6 @@ pub fn ensureInterpreterExists(self: *DocumentStore, uri: Uri) !void {
var int = try self.allocator.create(ComptimeInterpreter); var int = try self.allocator.create(ComptimeInterpreter);
int.* = ComptimeInterpreter{ int.* = ComptimeInterpreter{
.allocator = self.allocator, .allocator = self.allocator,
.arena = std.heap.ArenaAllocator.init(self.allocator),
.document_store = self, .document_store = self,
.uri = uri, .uri = uri,
}; };