diff options
Diffstat (limited to 'src/zisp/value')
| -rw-r--r-- | src/zisp/value/list.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/zisp/value/list.zig b/src/zisp/value/list.zig index d040a34..52c665e 100644 --- a/src/zisp/value/list.zig +++ b/src/zisp/value/list.zig @@ -26,7 +26,7 @@ pub fn assert(v: Value) void { pub fn new(alloc: Alloc, pool: ?*ListPool, vals: []const Value) !Value { var len_tagged_ptr: u48 = undefined; if (vals.len < 8 and pool != null) { - const ptr = try pool.?.create(@intCast(vals.len)); + const ptr = try pool.?.allocVals(@intCast(vals.len)); for (vals, 0..) |v, i| ptr[i] = v; len_tagged_ptr = @intCast(@intFromPtr(ptr) | vals.len); } else { @@ -38,6 +38,11 @@ pub fn new(alloc: Alloc, pool: ?*ListPool, vals: []const Value) !Value { return .{ .list = .{ .len_tagged_ptr = len_tagged_ptr } }; } +// TODO: this is just a test +pub fn free(list: Value) !void { + try gc.mainListPool().freeList(list); +} + pub fn getLenTag(v: Value) u3 { return @truncate(v.bits); } |
