diff options
author | Arne Döring <arne.doering@gmx.net> | 2020-04-19 07:52:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-19 07:52:01 +0200 |
commit | 4005f0d0e40fb57efd8144c065a7ba56d940b572 (patch) | |
tree | 7df2d805351ed3c72114d00c773ff7d581337eda /lib/system/alloc.nim | |
parent | a8f030fea21894e51c188a5804b0bbf787335f4d (diff) | |
download | Nim-4005f0d0e40fb57efd8144c065a7ba56d940b572.tar.gz |
forward type alignment information to seqs (#12430)
Diffstat (limited to 'lib/system/alloc.nim')
-rw-r--r-- | lib/system/alloc.nim | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim index 95d5ae7ee..7ace0d536 100644 --- a/lib/system/alloc.nim +++ b/lib/system/alloc.nim @@ -45,7 +45,6 @@ type data: TrunkBuckets type - AlignType = BiggestFloat FreeCell {.final, pure.} = object next: ptr FreeCell # next free cell in chunk (overlaid with refcount) when not defined(gcDestructors): @@ -68,16 +67,20 @@ type freeList: ptr FreeCell free: int # how many bytes remain acc: int # accumulator for small object allocation - when defined(cpu32): - align: int - data: AlignType # start of usable memory + when defined(nimAlignPragma): + data {.align: MemAlign.}: UncheckedArray[byte] # start of usable memory + else: + data: UncheckedArray[byte] BigChunk = object of BaseChunk # not necessarily > PageSize! next, prev: PBigChunk # chunks of the same (or bigger) size - data: AlignType # start of usable memory + when defined(nimAlignPragma): + data {.align: MemAlign.}: UncheckedArray[byte] # start of usable memory + else: + data: UncheckedArray[byte] -template smallChunkOverhead(): untyped = sizeof(SmallChunk)-sizeof(AlignType) -template bigChunkOverhead(): untyped = sizeof(BigChunk)-sizeof(AlignType) +template smallChunkOverhead(): untyped = sizeof(SmallChunk) +template bigChunkOverhead(): untyped = sizeof(BigChunk) # ------------- chunk table --------------------------------------------------- # We use a PtrSet of chunk starts and a table[Page, chunksize] for chunk |