- removed the longjmp based exception catch/rethrow mechanism and instead force-terminate in case a user exception is thrown while the VM is executing JITed code on a non-Windows system

On Windows none of this is needed, because we can generate a proper unwind frame for the JITed functions, but even on Linux, it would require manual additions to each single piece of native code that ever gets called from inside a JIT compiled function.
This is an utterly prohibitive proposition because it makes direct native calls a virtual impossibility
So, in order to get the thrown error properly presented both I_Error and ThrowAbortException will now forward to I_FatalError if it is called from inside a JIT context.
This commit is contained in:
Christoph Oelckers 2018-11-25 12:36:00 +01:00
commit 42b9a41421
6 changed files with 110 additions and 172 deletions

View file

@ -316,19 +316,10 @@ void JitCompiler::SetupSimpleFrame()
static VMFrameStack *CreateFullVMFrame(VMScriptFunction *func, VMValue *args, int numargs)
{
try
{
VMFrameStack *stack = &GlobalVMStack;
VMFrame *newf = stack->AllocFrame(func);
CurrentJitExceptInfo->vmframes++;
VMFillParams(args, newf, numargs);
return stack;
}
catch (...)
{
VMThrowException(std::current_exception());
return nullptr;
}
VMFrameStack *stack = &GlobalVMStack;
VMFrame *newf = stack->AllocFrame(func);
VMFillParams(args, newf, numargs);
return stack;
}
void JitCompiler::SetupFullVMFrame()
@ -362,15 +353,7 @@ void JitCompiler::SetupFullVMFrame()
static void PopFullVMFrame(VMFrameStack *stack)
{
try
{
stack->PopFrame();
CurrentJitExceptInfo->vmframes--;
}
catch (...)
{
VMThrowException(std::current_exception());
}
stack->PopFrame();
}
void JitCompiler::EmitPopFrame()
@ -434,14 +417,7 @@ void JitCompiler::EmitNullPointerThrow(int index, EVMAbortException reason)
void JitCompiler::ThrowException(VMScriptFunction *func, VMOP *line, int reason)
{
try
{
ThrowAbortException(func, line, (EVMAbortException)reason, nullptr);
}
catch (...)
{
VMThrowException(std::current_exception());
}
ThrowAbortException(func, line, (EVMAbortException)reason, nullptr);
}
void JitCompiler::EmitThrowException(EVMAbortException reason)