summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-09-19 15:16:54 +0800
committerGitHub <noreply@github.com>2022-09-19 09:16:54 +0200
commit97259a5ab37892bedca64b14ffc6e0b7d25dd789 (patch)
tree381c01a9f9eadbb3bc3900bc33f4aa342e450109 /compiler
parentf6dc30e52d94f433d1a132d73a5cf357c57e6a34 (diff)
downloadNim-97259a5ab37892bedca64b14ffc6e0b7d25dd789.tar.gz
fixes #19713; Revert "Remove tlsEmulation enabled from Windows + GCC config" (#19119) (#20327)
* Revert "Remove tlsEmulation enabled from Windows + GCC config (#19119) [backport:1.6]"

This reverts commit 77b696c2c92b5f478526290c5e184a4c41060f7b.

* increase nimTlsSize to 48000

* enable for windows

* fixes tests

* fixes tlsEmulation:on
Diffstat (limited to 'compiler')
-rw-r--r--compiler/nim.cfg1
-rw-r--r--compiler/ropes.nim8
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/nim.cfg b/compiler/nim.cfg
index 7ed70fb5f..853a657b3 100644
--- a/compiler/nim.cfg
+++ b/compiler/nim.cfg
@@ -11,6 +11,7 @@ define:nimPreviewSlimSystem
 
 @if windows:
   cincludes: "$lib/wrappers/libffi/common"
+  tlsEmulation:off
 @end
 
 define:useStdoutAsStdmsg
diff --git a/compiler/ropes.nim b/compiler/ropes.nim
index 3a2fbe44e..b84cfad52 100644
--- a/compiler/ropes.nim
+++ b/compiler/ropes.nim
@@ -86,8 +86,12 @@ proc newRope(data: string = ""): Rope =
   result.L = -data.len
   result.data = data
 
-var
-  cache {.threadvar.} : array[0..2048*2 - 1, Rope]
+when compileOption("tlsEmulation"): # fixme: be careful if you want to make ropes support multiple threads
+  var
+    cache: array[0..2048*2 - 1, Rope]
+else:
+  var
+    cache {.threadvar.} : array[0..2048*2 - 1, Rope]
 
 proc resetRopeCache* =
   for i in low(cache)..high(cache):