Improve setjmp()/longjmp() performance.
Exception handling for the C backend used setjmp()/longjmp() unconditionally. However, on POSIX systems, these functions save and restore the signal mask, adding considerable overhead to exception handling, even where no exceptions are involved. The compiler and library now try to use either _setjmp()/_longjmp() or sigsetjmp()/siglongjmp() where possible, marked by the defines "nimRawSetjmp" and "nimSigSetjmp", respectively. The define "nimStdSetjmp" can be used to revert to setjmp()/longjmp() instead.
This commit is contained in:
parent
9f047f4351
commit
f99c40f61b
4 changed files with 28 additions and 6 deletions
|
|
@ -136,3 +136,5 @@ proc initDefines*() =
|
|||
declareSymbol("emulatedthreadvars")
|
||||
if platform.OS[targetOS].props.contains(ospLacksThreadVars):
|
||||
defineSymbol("emulatedthreadvars")
|
||||
if isDefined("posix"):
|
||||
defineSymbol("nimRawSetjmp")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue