- implement throwing by storing exception information in a struct, then return from the jitted function and throw from c++
This commit is contained in:
parent
b6f52c319a
commit
3453f05f06
5 changed files with 69 additions and 28 deletions
|
|
@ -80,17 +80,16 @@ static int Exec(VMFrameStack *stack, const VMOP *pc, VMReturn *ret, int numret)
|
|||
sfunc->JitFunc = JitCompile(sfunc);
|
||||
sfunc->JitCompiled = true;
|
||||
}
|
||||
if (sfunc->JitFunc) {
|
||||
try {
|
||||
return sfunc->JitFunc(stack, ®, ret, numret);
|
||||
}
|
||||
catch (CVMAbortException &err)
|
||||
if (sfunc->JitFunc)
|
||||
{
|
||||
JitExceptionInfo exceptInfo;
|
||||
exceptInfo.reason = -1;
|
||||
int result = sfunc->JitFunc(stack, ®, ret, numret, &exceptInfo);
|
||||
if (exceptInfo.reason != -1)
|
||||
{
|
||||
err.MaybePrintMessage();
|
||||
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(sfunc->pcOnJitAbort));
|
||||
// PrintParameters(reg.param + f->NumParam - B, B);
|
||||
throw;
|
||||
ThrowAbortException(sfunc, exceptInfo.pcOnJitAbort, (EVMAbortException)exceptInfo.reason, nullptr);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue