- removed the no longer needed exception prevention hack.

# Conflicts:
#	src/scripting/vm/vmframe.cpp
This commit is contained in:
Christoph Oelckers 2018-12-01 14:26:15 +01:00
parent 067e9de00a
commit 85a3edf583
4 changed files with 7 additions and 46 deletions

View file

@ -173,7 +173,6 @@ void I_FatalError(const char* const error, ...)
} }
extern thread_local int jit_frames;
void I_Error (const char *error, ...) void I_Error (const char *error, ...)
{ {
va_list argptr; va_list argptr;
@ -181,17 +180,9 @@ void I_Error (const char *error, ...)
va_start(argptr, error); va_start(argptr, error);
if (jit_frames == 0) vsprintf (errortext, error, argptr);
{ va_end (argptr);
vsprintf (errortext, error, argptr); throw CRecoverableError(errortext);
va_end (argptr);
throw CRecoverableError(errortext);
}
else
{
I_FatalError(error, argptr);
va_end(argptr);
}
} }

View file

@ -220,7 +220,6 @@ void I_FatalError(const char* const error, ...)
} }
extern thread_local int jit_frames;
void I_Error (const char *error, ...) void I_Error (const char *error, ...)
{ {
va_list argptr; va_list argptr;
@ -228,17 +227,9 @@ void I_Error (const char *error, ...)
va_start(argptr, error); va_start(argptr, error);
if (jit_frames == 0) vsprintf (errortext, error, argptr);
{ va_end (argptr);
vsprintf (errortext, error, argptr); throw CRecoverableError(errortext);
va_end (argptr);
throw CRecoverableError(errortext);
}
else
{
I_FatalError(error, argptr);
va_end(argptr);
}
} }
void I_SetIWADInfo () void I_SetIWADInfo ()

View file

@ -58,17 +58,6 @@ CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL)
CVAR(Bool, vm_jit, false, CVAR_NOINITCALL|CVAR_NOSET) CVAR(Bool, vm_jit, false, CVAR_NOINITCALL|CVAR_NOSET)
#endif #endif
// On Windows we can rely on the system's unwinder to deal with JITed code.
// On Linux we can not and need to be able to tell the error management that we have some JITed code in the call chain.
#ifdef _WIN32
inline void beginVM() { }
inline void endVM() { }
#else
thread_local int jit_frames;
inline void beginVM() { if (vm_jit) jit_frames++; }
inline void endVM() { if (vm_jit) jit_frames--; }
#endif
cycle_t VMCycles[10]; cycle_t VMCycles[10];
int VMCalls[10]; int VMCalls[10];
@ -581,9 +570,7 @@ int VMCall(VMFunction *func, VMValue *params, int numparams, VMReturn *results,
VMCycles[0].Clock(); VMCycles[0].Clock();
auto sfunc = static_cast<VMScriptFunction *>(func); auto sfunc = static_cast<VMScriptFunction *>(func);
beginVM();
int numret = sfunc->ScriptCall(sfunc, params, numparams, results, numresults); int numret = sfunc->ScriptCall(sfunc, params, numparams, results, numresults);
endVM();
VMCycles[0].Unclock(); VMCycles[0].Unclock();
return numret; return numret;
} }
@ -702,15 +689,6 @@ void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException
CVMAbortException err(reason, moreinfo, ap); CVMAbortException err(reason, moreinfo, ap);
#ifndef _WIN32)
// Without a usable unwinder, aborting is the only real option here. :(
if (jit_frames)
{
I_FatalError("VM error: %s", err.what());
}
#endif
err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line)); err.stacktrace.AppendFormat("Called from %s at %s, line %d\n", sfunc->PrintableName.GetChars(), sfunc->SourceFileName.GetChars(), sfunc->PCToLine(line));
throw err; throw err;
va_end(ap); va_end(ap);

View file

@ -506,6 +506,7 @@ DEFINE_ACTION_FUNCTION(DBrokenLines, StringWidth)
DEFINE_ACTION_FUNCTION(DBrokenLines, StringAt) DEFINE_ACTION_FUNCTION(DBrokenLines, StringAt)
{ {
PARAM_SELF_PROLOGUE(DBrokenLines); PARAM_SELF_PROLOGUE(DBrokenLines);
PARAM_INT(index); PARAM_INT(index);
ACTION_RETURN_STRING((unsigned)index >= self->mBroken.Size() ? -1 : self->mBroken[index].Text); ACTION_RETURN_STRING((unsigned)index >= self->mBroken.Size() ? -1 : self->mBroken[index].Text);