- implement throwing by storing exception information in a struct, then return from the jitted function and throw from c++

This commit is contained in:
Magnus Norddahl 2018-08-18 22:41:18 +02:00
commit 3453f05f06
5 changed files with 69 additions and 28 deletions

View file

@ -577,6 +577,16 @@ void ThrowAbortException(EVMAbortException reason, const char *moreinfo, ...)
va_end(ap);
}
void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException reason, const char *moreinfo, ...)
{
va_list ap;
va_start(ap, moreinfo);
CVMAbortException err(reason, moreinfo, ap);
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line));
throw err;
va_end(ap);
}
DEFINE_ACTION_FUNCTION(DObject, ThrowAbortException)
{
PARAM_PROLOGUE;