forward type alignment information to seqs (#12430)

This commit is contained in:
Arne Döring 2020-04-19 07:52:01 +02:00 • committed by GitHub
commit 4005f0d0e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 152 additions and 114 deletions

View file

@ -46,7 +46,7 @@ const
PageSize = 1 shl PageShift
PageMask = PageSize-1
MemAlign = 8 # also minimal allocatable memory block
MemAlign = 16 # also minimal allocatable memory block
BitsPerPage = PageSize div MemAlign
UnitsPerPage = BitsPerPage div (sizeof(int)*8)
@ -108,7 +108,7 @@ when not declared(nimNewSeqOfCap) and not defined(nimSeqsV2):
let s = cap * typ.base.size # newStr already adds GenericSeqSize
result = newStr(typ, s, ntfNoRefs notin typ.base.flags)
else:
let s = cap * typ.base.size + GenericSeqSize
let s = align(GenericSeqSize, typ.base.align) + cap * typ.base.size
when declared(newObjNoInit):
result = if ntfNoRefs in typ.base.flags: newObjNoInit(typ, s) else: newObj(typ, s)
else: