From e26e81aa33dc1ecc2f26de26b1d420d288a28493 Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Sun, 16 Aug 2026 10:01:12 +0200 Subject: Implemented meta allocator. --- src/zisp/gc/IstrPool.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/zisp/gc/IstrPool.zig') diff --git a/src/zisp/gc/IstrPool.zig b/src/zisp/gc/IstrPool.zig index bbf6e63..81b4632 100644 --- a/src/zisp/gc/IstrPool.zig +++ b/src/zisp/gc/IstrPool.zig @@ -11,6 +11,7 @@ const std = @import("std"); const Alloc = std.mem.Allocator; +const gc = @import("../gc.zig"); const value = @import("../value.zig"); const Value = value.Value; @@ -130,8 +131,9 @@ fn getOrPutOrNew(self: *Self, sptr: [*]const u8, len: u8, put: ?Value) !Value { fn newIstr(self: *Self, sptr: [*]const u8, len: u8) !Value { // TODO: Alloc manually in slabs, like ListPool FlexiBlock. - const ptr = try self.alloc.alloc(len); - const idx = gc.istrIdxFromPtr(ptr); + const s = try self.alloc.alloc(u8, len); + @memcpy(s, sptr[0..len]); + const idx = gc.istrIdxFromPtr(s.ptr); return .{ .istr = .{ .idx = idx, .len = len } }; } -- cgit v1.2.3