mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-24 07:31:41 +00:00
check
This commit is contained in:
@@ -460,7 +460,7 @@ proc rawNewObj(typ: PNimType, size: int, gch: var GcHeap): pointer =
|
||||
collectCT(gch)
|
||||
# Use alignment from typ.base if available, otherwise use MemAlign
|
||||
let alignment = if typ.kind == tyRef and typ.base != nil and
|
||||
typ.base.align > MemAlign: typ.base.align else: 0
|
||||
typ.base.align > 16: typ.base.align else: 0
|
||||
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
|
||||
@@ -517,7 +517,7 @@ proc newObjRC1(typ: PNimType, size: int): pointer {.compilerRtl, noinline, raise
|
||||
|
||||
# Use alignment from typ.base if available, otherwise use MemAlign
|
||||
let alignment = if typ.kind == tyRef and typ.base != nil and
|
||||
typ.base.align > MemAlign: typ.base.align else: 0
|
||||
typ.base.align > 16: typ.base.align else: 0
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user