Allow to configure tls size (#6171)
This commit is contained in:
parent
7be896a75a
commit
03fc7f3941
1 changed files with 7 additions and 2 deletions
|
|
@ -256,8 +256,9 @@ when emulatedThreadVars:
|
||||||
# we preallocate a fixed size for thread local storage, so that no heap
|
# 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.
|
# allocations are needed. Currently less than 7K are used on a 64bit machine.
|
||||||
# We use ``float`` for proper alignment:
|
# We use ``float`` for proper alignment:
|
||||||
|
const nimTlsSize {.intdefine.} = 8000
|
||||||
type
|
type
|
||||||
ThreadLocalStorage = array[0..1_000, float]
|
ThreadLocalStorage = array[0..(nimTlsSize div sizeof(float)), float]
|
||||||
|
|
||||||
PGcThread = ptr GcThread
|
PGcThread = ptr GcThread
|
||||||
GcThread {.pure, inheritable.} = object
|
GcThread {.pure, inheritable.} = object
|
||||||
|
|
@ -323,7 +324,11 @@ when not defined(useNimRtl):
|
||||||
|
|
||||||
when emulatedThreadVars:
|
when emulatedThreadVars:
|
||||||
if nimThreadVarsSize() > sizeof(ThreadLocalStorage):
|
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
|
quit 1
|
||||||
|
|
||||||
when hasSharedHeap and not defined(boehmgc) and not defined(gogc) and not defined(nogc):
|
when hasSharedHeap and not defined(boehmgc) and not defined(gogc) and not defined(nogc):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue