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

@ -172,7 +172,7 @@ when not defined(useNimRtl):
template payloadPtr(x: untyped): untyped = cast[PGenericSeq](x).p
else:
const payloadOffset = GenericSeqSize
const payloadOffset = GenericSeqSize ## the payload offset always depends on the alignment of the member type.
template payloadPtr(x: untyped): untyped = x
proc reprSequence(result: var string, p: pointer, typ: PNimType,
@ -185,7 +185,7 @@ when not defined(useNimRtl):
var bs = typ.base.size
for i in 0..cast[PGenericSeq](p).len-1:
if i > 0: add result, ", "
reprAux(result, cast[pointer](cast[ByteAddress](payloadPtr(p)) + payloadOffset + i*bs),
reprAux(result, cast[pointer](cast[ByteAddress](payloadPtr(p)) + align(payloadOffset, typ.align) + i*bs),
typ.base, cl)
add result, "]"