From a4cf69cf3861b62693131536950d81681cbe15ef Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 16 Feb 2026 18:32:50 +0800 Subject: [PATCH] progress --- lib/system/gc.nim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/system/gc.nim b/lib/system/gc.nim index 73718f25a0..63b8b2cbd2 100644 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -463,7 +463,10 @@ proc rawNewObj(typ: PNimType, size: int, gch: var GcHeap): pointer = var res = cast[PCell](rawAlloc(gch.region, size + sizeof(Cell), alignment)) #gcAssert typ.kind in {tyString, tySequence} or size >= typ.base.size, "size too small" # Check that the user data (after the Cell header) is properly aligned - gcAssert((cast[int](cellToUsr(res)) and (alignment-1)) == 0, "newObj: 23") + if alignment > MemAlign: + gcAssert((cast[int](cellToUsr(res)) and (alignment-1)) == 0, "newObj: 2.1") + else: + gcAssert((cast[int](res) and (MemAlign-1)) == 0, "newObj: 2.2") # now it is buffered in the ZCT res.typ = typ setFrameInfo(res) @@ -516,7 +519,10 @@ proc newObjRC1(typ: PNimType, size: int): pointer {.compilerRtl, noinline, raise var res = cast[PCell](rawAlloc(gch.region, size + sizeof(Cell), alignment)) sysAssert(allocInv(gch.region), "newObjRC1 after rawAlloc") # Check that the user data (after the Cell header) is properly aligned - sysAssert((cast[int](cellToUsr(res)) and (alignment-1)) == 0, "newObj: 23") + if alignment > MemAlign: + sysAssert((cast[int](cellToUsr(res)) and (alignment-1)) == 0, "newObj: 2.1") + else: + sysAssert((cast[int](res) and (MemAlign-1)) == 0, "newObj: 2.2") # now it is buffered in the ZCT res.typ = typ setFrameInfo(res)