Implement registering JIT unwind information on Windows.
This commit implements registering unwind information for JIT functions on Windows so that the operating system can both walk and unwind stacks containing JIT frames. Currently this only works with Cranelift as lightbeam does not emit unwind information yet. This commit also resets the stack guard page on Windows for stack overflow exceptions, allowing reliable stack overflow traps. With these changes, all previously disabled test suite tests (not including the multi-value tests) on Windows are now passing. Fixes #291.
This commit is contained in:
@@ -404,7 +404,7 @@ static
|
||||
__attribute__ ((warn_unused_result))
|
||||
#endif
|
||||
bool
|
||||
HandleTrap(CONTEXT* context)
|
||||
HandleTrap(CONTEXT* context, bool reset_guard_page)
|
||||
{
|
||||
assert(sAlreadyHandlingTrap);
|
||||
|
||||
@@ -412,7 +412,7 @@ HandleTrap(CONTEXT* context)
|
||||
return false;
|
||||
}
|
||||
|
||||
RecordTrap(ContextToPC(context));
|
||||
RecordTrap(ContextToPC(context), reset_guard_page);
|
||||
|
||||
// Unwind calls longjmp, so it doesn't run the automatic
|
||||
// sAlreadhHanldingTrap cleanups, so reset it manually before doing
|
||||
@@ -467,7 +467,8 @@ WasmTrapHandler(LPEXCEPTION_POINTERS exception)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
if (!HandleTrap(exception->ContextRecord)) {
|
||||
if (!HandleTrap(exception->ContextRecord,
|
||||
record->ExceptionCode == EXCEPTION_STACK_OVERFLOW)) {
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
@@ -549,7 +550,7 @@ HandleMachException(const ExceptionRequest& request)
|
||||
|
||||
{
|
||||
AutoHandlingTrap aht;
|
||||
if (!HandleTrap(&context)) {
|
||||
if (!HandleTrap(&context, false)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -632,7 +633,7 @@ WasmTrapHandler(int signum, siginfo_t* info, void* context)
|
||||
if (!sAlreadyHandlingTrap) {
|
||||
AutoHandlingTrap aht;
|
||||
assert(signum == SIGSEGV || signum == SIGBUS || signum == SIGFPE || signum == SIGILL);
|
||||
if (HandleTrap(static_cast<CONTEXT*>(context))) {
|
||||
if (HandleTrap(static_cast<CONTEXT*>(context), false)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user