summaryrefslogtreecommitdiff
path: root/src/zisp/gc/ListPool.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/zisp/gc/ListPool.zig')
-rw-r--r--src/zisp/gc/ListPool.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/zisp/gc/ListPool.zig b/src/zisp/gc/ListPool.zig
index d63a6f8..127456a 100644
--- a/src/zisp/gc/ListPool.zig
+++ b/src/zisp/gc/ListPool.zig
@@ -117,7 +117,7 @@ const Block = [block_size]Value;
// should be multiples of 2 (and even 4) so we could divide them to make them
// fit in a u8 each, fitting the whole map in a cache line, but then we'd need
// to multiply them (shift-left) on extraction, so whatever.
-const chunk_real_idx_map: [39]u16 = undefined;
+var chunk_real_idx_map: [39]u16 = undefined;
comptime {
// zig fmt: off
for ( 0..30) |i| chunk_real_idx_map[i] = ( i * 12 + 0 * 16);
@@ -137,7 +137,7 @@ const chunk_empty_big: u64 = (2 ^ 1 - 1) << 38;
const array_block_chunk_size = 32;
const array_block_max_index = block_size / array_block_chunk_size;
-const FreeListNode = packed union(u64) {
+const FreeListNode = union {
bits: u64,
vals_ptr: [*]Value,
prev_ptr: *FreeListNode,
@@ -190,12 +190,12 @@ pub fn deinit(self: *Self) void {
self.alloc.destroy(self.cur_flexi_block);
}
-fn pushFree(list: *FreeListNode, len: u8, ptr: [*]Value) void {
+fn pushFree(list: *FreeListNode, ptr: [*]Value) void {
ptr[0].bits = list.bits;
list.vals_ptr = ptr;
}
-fn popFree(list: *FreeListNode, len: u8) ?[*]Value {
+fn popFree(list: *FreeListNode) ?[*]Value {
if (list.bits == 0) return null;
const ptr = list.vals_ptr;
list.* = list.prev_ptr.*;
@@ -215,7 +215,7 @@ fn newChunkBlock(self: *Self) !void {
// Put unused chunks in free lists:
var empty = self.cur_chunk_empty;
while (empty != 0) {
- const idx = @ctz(chunks);
+ const idx = @ctz(empty);
if (idx < 30) {
pushFree(&self.chunk_free_lists[0], curChunkBlockPtr(idx));
empty &= ~@shlExact(@as(u64, 1), @intCast(idx));