From dc8b4130553be06174bd6dba4b3a252d955ba781 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:36:57 +0800 Subject: [PATCH] padding `Cell` --- lib/system/bitmasks.nim | 3 --- lib/system/mmdisp.nim | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/system/bitmasks.nim b/lib/system/bitmasks.nim index 76be575a63..0663247c28 100644 --- a/lib/system/bitmasks.nim +++ b/lib/system/bitmasks.nim @@ -24,9 +24,6 @@ const elif defined(useMalloc): when defined(amd64): 16 else: 8 - elif defined(gcRefc): - when defined(i386): 8 - else: 16 else: 16 BitsPerPage = PageSize div MemAlign diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim index ce935ff8af..0f3a154b8e 100644 --- a/lib/system/mmdisp.nim +++ b/lib/system/mmdisp.nim @@ -45,6 +45,9 @@ when not defined(nimV2): Cell {.pure.} = object refcount: RefCount # the refcount and some flags typ: PNimType + when sizeof(int) == 4: # 32-bit only + headerAlignPad: array[8, byte] # so addr(data) ≡ 8 (mod 16) + when trackAllocationSource: filename: cstring line: int @@ -93,7 +96,7 @@ else: when not usesDestructors: include "system/cellsets" when not leakDetector and not useCellIds and not defined(nimV2): - sysAssert(sizeof(Cell) == sizeof(FreeCell), "sizeof FreeCell") + sysAssert(sizeof(FreeCell) <= sizeof(Cell), "sizeof FreeCell") when defined(gcRegions): # XXX due to bootstrapping reasons, we cannot use compileOption("gc", "stack") here include "system/gc_regions"