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

@ -78,8 +78,11 @@ template decTypeSize(cell, t) =
when defined(nimTypeNames):
if t.kind in {tyString, tySequence}:
let cap = cast[PGenericSeq](cellToUsr(cell)).space
let size = if t.kind == tyString: cap+1+GenericSeqSize
else: cap * t.base.size + GenericSeqSize
let size =
if t.kind == tyString:
cap + 1 + GenericSeqSize
else:
align(GenericSeqSize, t.base.align) + cap * t.base.size
atomicDec t.sizes, size+sizeof(Cell)
else:
atomicDec t.sizes, t.base.size+sizeof(Cell)