- catch and rethrow c++ exceptions

This commit is contained in:
Magnus Norddahl 2018-10-07 20:38:08 +02:00
commit f321f64a05
6 changed files with 41 additions and 39 deletions

View file

@ -86,7 +86,10 @@ static int Exec(VMFrameStack *stack, const VMOP *pc, VMReturn *ret, int numret)
int result = sfunc->JitFunc(stack, ret, numret, &exceptInfo);
if (exceptInfo.reason != -1)
{
ThrowAbortException(sfunc, exceptInfo.pcOnJitAbort, (EVMAbortException)exceptInfo.reason, nullptr);
if (exceptInfo.cppException)
std::rethrow_exception(exceptInfo.cppException);
else
ThrowAbortException(sfunc, exceptInfo.pcOnJitAbort, (EVMAbortException)exceptInfo.reason, nullptr);
}
return result;
}