summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/nim.cfg1
-rw-r--r--compiler/ropes.nim8
-rw-r--r--config/nim.cfg3
-rw-r--r--tests/config.nims2
4 files changed, 12 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):
diff --git a/config/nim.cfg b/config/nim.cfg
index fd2642391..55b7a41c1 100644
--- a/config/nim.cfg
+++ b/config/nim.cfg
@@ -169,6 +169,9 @@ nimblepath="$home/.nimble/pkgs/"
 # Configuration for the GNU C/C++ compiler:
 @if windows:
   #gcc.path = r"$nim\dist\mingw\bin"
+  @if gcc or tcc:
+    tlsEmulation:on
+  @end
 @end
 
 gcc.maxerrorsimpl = "-fmax-errors=3"
diff --git a/tests/config.nims b/tests/config.nims
index 894c4bea0..5195ebcaf 100644
--- a/tests/config.nims
+++ b/tests/config.nims
@@ -40,3 +40,5 @@ switch("define", "nimPreviewFloatRoundtrip")
 switch("define", "nimPreviewDotLikeOps")
 switch("define", "nimPreviewJsonutilsHoleyEnum")
 switch("define", "nimPreviewHashRef")
+when defined(windows):
+  switch("tlsEmulation", "off")