Skip to content

Commit

Permalink
use align pragma
Browse files Browse the repository at this point in the history
  • Loading branch information
krux02 committed Nov 22, 2019
1 parent 4395f05 commit 8c0ea49
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
7 changes: 0 additions & 7 deletions lib/nimalloc.h

This file was deleted.

5 changes: 2 additions & 3 deletions lib/system/alloc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ type
data: TrunkBuckets

type
AlignType {.importc: "NimAlign16Type", header: "nimalloc.h".} = object
FreeCell {.final, pure.} = object
next: ptr FreeCell # next free cell in chunk (overlaid with refcount)
zeroField: int # 0 means cell is not used (overlaid with typ field)
Expand All @@ -65,11 +64,11 @@ type
freeList: ptr FreeCell
free: int # how many bytes remain
acc: int # accumulator for small object allocation
data: UncheckedArray[AlignType] # start of usable memory
data {.align: MemAlign.}: UncheckedArray[byte] # start of usable memory

BigChunk = object of BaseChunk # not necessarily > PageSize!
next, prev: PBigChunk # chunks of the same (or bigger) size
data: UncheckedArray[AlignType] # start of usable memory
data {.align: MemAlign.}: UncheckedArray[byte] # start of usable memory

template smallChunkOverhead(): untyped = sizeof(SmallChunk)
template bigChunkOverhead(): untyped = sizeof(BigChunk)
Expand Down

0 comments on commit 8c0ea49

Please sign in to comment.