From 02ad98e6e1f2261adbc1d57129235af962e070c0 Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Sat, 22 Aug 2026 22:49:49 +0200 Subject: Little meta-alloc improvement. --- src/zisp/gc/meta_alloc.zig | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/zisp/gc/meta_alloc.zig b/src/zisp/gc/meta_alloc.zig index 4dec92d..aa21967 100644 --- a/src/zisp/gc/meta_alloc.zig +++ b/src/zisp/gc/meta_alloc.zig @@ -476,9 +476,11 @@ export fn flush_thread_reserves() void { const tl = &tl_slab_infos[sci]; const slab: *Slab = &slabs[sci]; - // Just a rough check, assuming 4 KiB pages: If wm_hi - wm_lo >= 8 KiB, - // it means there's a minimum of one untouched page in between. - if (tl.wm_hi - tl.wm_lo > 8192 / @sizeOf(Unit)) { + // Given our chunked WM bumps and smallest size class, hi - lo > 4 KiB + // implies that there's at least one entire untouched page, as well as + // at least one >=128-byte slot before it, which can hold the metadata + // of the vacancy-list entry without faulting in an empty page. + if (tl.wm_hi - tl.wm_lo > 4096 / @sizeOf(Unit)) { flush_to_vl(info, tl, slab); } -- cgit v1.2.3