Skip to content

Commit

Permalink
fixes #19713; Revert "Remove tlsEmulation enabled from Windows + GCC …
Browse files Browse the repository at this point in the history
…config" (#19119) (#20327)

* Revert "Remove tlsEmulation enabled from Windows + GCC config (#19119) [backport:1.6]"

This reverts commit 77b696c.

* increase nimTlsSize to 48000

* enable for windows

* fixes tests

* fixes tlsEmulation:on
  • Loading branch information
ringabout committed Sep 19, 2022
1 parent f6dc30e commit 97259a5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions compiler/nim.cfg
Expand Up @@ -11,6 +11,7 @@ define:nimPreviewSlimSystem

@if windows:
cincludes: "$lib/wrappers/libffi/common"
tlsEmulation:off
@end

define:useStdoutAsStdmsg
Expand Down
8 changes: 6 additions & 2 deletions compiler/ropes.nim
Expand Up @@ -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):
Expand Down
3 changes: 3 additions & 0 deletions config/nim.cfg
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions tests/config.nims
Expand Up @@ -40,3 +40,5 @@ switch("define", "nimPreviewFloatRoundtrip")
switch("define", "nimPreviewDotLikeOps")
switch("define", "nimPreviewJsonutilsHoleyEnum")
switch("define", "nimPreviewHashRef")
when defined(windows):
switch("tlsEmulation", "off")

0 comments on commit 97259a5

Please sign in to comment.