mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-16 16:14:20 +00:00
Allow to configure tls size (#6171)
This commit is contained in:
committed by
Andreas Rumpf
parent
7be896a75a
commit
03fc7f3941
@@ -256,8 +256,9 @@ when emulatedThreadVars:
|
||||
# we preallocate a fixed size for thread local storage, so that no heap
|
||||
# allocations are needed. Currently less than 7K are used on a 64bit machine.
|
||||
# We use ``float`` for proper alignment:
|
||||
const nimTlsSize {.intdefine.} = 8000
|
||||
type
|
||||
ThreadLocalStorage = array[0..1_000, float]
|
||||
ThreadLocalStorage = array[0..(nimTlsSize div sizeof(float)), float]
|
||||
|
||||
PGcThread = ptr GcThread
|
||||
GcThread {.pure, inheritable.} = object
|
||||
@@ -323,7 +324,11 @@ when not defined(useNimRtl):
|
||||
|
||||
when emulatedThreadVars:
|
||||
if nimThreadVarsSize() > sizeof(ThreadLocalStorage):
|
||||
echo "too large thread local storage size requested"
|
||||
echo "too large thread local storage size requested ",
|
||||
"(", nimThreadVarsSize(), "/", sizeof(ThreadLocalStorage), "). ",
|
||||
"Use -d:\"nimTlsSize=", nimThreadVarsSize(),
|
||||
"\" to preallocate sufficient storage."
|
||||
|
||||
quit 1
|
||||
|
||||
when hasSharedHeap and not defined(boehmgc) and not defined(gogc) and not defined(nogc):
|
||||
|
||||
Reference in New Issue
Block a user