nimRawSetjmp: support Windows (#19197)

* nimRawSetjmp: support Windows

Using `_setjmp()` directly is required to avoid some rare (but very
annoying) exception-related stack corruption leading to segfaults on
Windows, with Mingw-w64 and SEH.
More details: https://github.com/status-im/nimbus-eth2/issues/3121

Also add "nimBuiltinSetjmp" - mostly for benchmarking.

* fix for Apple's Clang++
This commit is contained in:
Ștefan Talpalaru 2021-12-10 06:31:29 +01:00 • committed by GitHub
commit 69aabdab80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 199 additions and 10 deletions

View file

@ -1,4 +1,6 @@
discard """
disabled: "windows" # no sigsetjmp() there
matrix: "-d:nimStdSetjmp; -d:nimSigSetjmp; -d:nimRawSetjmp; -d:nimBuiltinSetjmp"
output: '''
BEFORE
@ -17,7 +19,7 @@ FINALLY
echo ""
proc no_expcetion =
proc no_exception =
try:
echo "BEFORE"
@ -28,7 +30,7 @@ proc no_expcetion =
finally:
echo "FINALLY"
try: no_expcetion()
try: no_exception()
except: echo "RECOVER"
echo ""