mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-03 20:44:46 +00:00
Enable customizing PageShift to set PageSize for embedded targets (#19129)
* Enable customizing PageSize (via PageShift).
This enables adjusting PageSize for embedded targets without abusing
cpu16.
* copy nimPageXYZ settings for mmpaptest
* add docs for Nim manual
* add docs for Nim manual
* docs tweaks
Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
(cherry picked from commit 92d6fb86c6)
This commit is contained in:
committed by
narimiran
parent
1dc47696c0
commit
b9363c8bb4
@@ -10,14 +10,18 @@
|
||||
# Page size of the system; in most cases 4096 bytes. For exotic OS or
|
||||
# CPU this needs to be changed:
|
||||
const
|
||||
PageShift = when defined(cpu16): 8 else: 12 # \
|
||||
# my tests showed no improvements for using larger page sizes.
|
||||
PageShift = when defined(nimPage256) or defined(cpu16): 8
|
||||
elif defined(nimPage512): 9
|
||||
elif defined(nimPage1k): 10
|
||||
else: 12 # \ # my tests showed no improvements for using larger page sizes.
|
||||
|
||||
PageSize = 1 shl PageShift
|
||||
PageMask = PageSize-1
|
||||
|
||||
|
||||
MemAlign = # also minimal allocatable memory block
|
||||
when defined(useMalloc):
|
||||
when defined(nimMemAlignTiny): 4
|
||||
elif defined(useMalloc):
|
||||
when defined(amd64): 16
|
||||
else: 8
|
||||
else: 16
|
||||
|
||||
Reference in New Issue
Block a user