Skip to content

Commit

Permalink
feat(compiler) Use special __intrinsec_setjmp instead of regular setj…
Browse files Browse the repository at this point in the history
…mp on Windows to avoid potential issue with jitted code
  • Loading branch information
ptitSeb committed Sep 17, 2021
1 parent 45f56d0 commit ca5dec1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/vm/src/trap/handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
// doesn't need to touch the kernel signal handling routines.
// In case of macOS, stackoverflow
#if defined(CFG_TARGET_OS_WINDOWS)
#define platform_setjmp(buf) setjmp(buf)
// On Windows, default setjmp/longjmp sequence will try to unwind the stack
// it's fine most of the time, but not for JIT'd code that may not respect stack ordring
// Using a special setjmp here, with NULL as second parameter to disable that behaviour
// and have a regular simple setjmp/longjmp sequence
#define platform_setjmp(buf) __intrinsic_setjmp(buf, NULL)
#define platform_longjmp(buf, arg) longjmp(buf, arg)
#define platform_jmp_buf jmp_buf
#elif defined(CFG_TARGET_OS_MACOS)
Expand Down

0 comments on commit ca5dec1

Please sign in to comment.