From 85a3edf583a1254ce2fc3eebf1fecac3c369edd7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 1 Dec 2018 14:26:15 +0100 Subject: [PATCH] - removed the no longer needed exception prevention hack. # Conflicts: # src/scripting/vm/vmframe.cpp --- src/posix/cocoa/i_system.mm | 15 +++------------ src/posix/sdl/i_system.cpp | 15 +++------------ src/scripting/vm/vmframe.cpp | 22 ---------------------- src/v_text.cpp | 1 + 4 files changed, 7 insertions(+), 46 deletions(-) diff --git a/src/posix/cocoa/i_system.mm b/src/posix/cocoa/i_system.mm index 870d4b8bb..e40202fc3 100644 --- a/src/posix/cocoa/i_system.mm +++ b/src/posix/cocoa/i_system.mm @@ -173,7 +173,6 @@ void I_FatalError(const char* const error, ...) } -extern thread_local int jit_frames; void I_Error (const char *error, ...) { va_list argptr; @@ -181,17 +180,9 @@ void I_Error (const char *error, ...) va_start(argptr, error); - if (jit_frames == 0) - { - vsprintf (errortext, error, argptr); - va_end (argptr); - throw CRecoverableError(errortext); - } - else - { - I_FatalError(error, argptr); - va_end(argptr); - } + vsprintf (errortext, error, argptr); + va_end (argptr); + throw CRecoverableError(errortext); } diff --git a/src/posix/sdl/i_system.cpp b/src/posix/sdl/i_system.cpp index 2a9c7ffc0..9f4797926 100644 --- a/src/posix/sdl/i_system.cpp +++ b/src/posix/sdl/i_system.cpp @@ -220,7 +220,6 @@ void I_FatalError(const char* const error, ...) } -extern thread_local int jit_frames; void I_Error (const char *error, ...) { va_list argptr; @@ -228,17 +227,9 @@ void I_Error (const char *error, ...) va_start(argptr, error); - if (jit_frames == 0) - { - vsprintf (errortext, error, argptr); - va_end (argptr); - throw CRecoverableError(errortext); - } - else - { - I_FatalError(error, argptr); - va_end(argptr); - } + vsprintf (errortext, error, argptr); + va_end (argptr); + throw CRecoverableError(errortext); } void I_SetIWADInfo () diff --git a/src/scripting/vm/vmframe.cpp b/src/scripting/vm/vmframe.cpp index f5ccc25b2..66af710f2 100644 --- a/src/scripting/vm/vmframe.cpp +++ b/src/scripting/vm/vmframe.cpp @@ -58,17 +58,6 @@ CUSTOM_CVAR(Bool, vm_jit, true, CVAR_NOINITCALL) CVAR(Bool, vm_jit, false, CVAR_NOINITCALL|CVAR_NOSET) #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]; int VMCalls[10]; @@ -581,9 +570,7 @@ int VMCall(VMFunction *func, VMValue *params, int numparams, VMReturn *results, VMCycles[0].Clock(); auto sfunc = static_cast(func); - beginVM(); int numret = sfunc->ScriptCall(sfunc, params, numparams, results, numresults); - endVM(); VMCycles[0].Unclock(); return numret; } @@ -702,15 +689,6 @@ void ThrowAbortException(VMScriptFunction *sfunc, VMOP *line, EVMAbortException 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)); throw err; va_end(ap); diff --git a/src/v_text.cpp b/src/v_text.cpp index 2eae3e9f3..9f6e41161 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -506,6 +506,7 @@ DEFINE_ACTION_FUNCTION(DBrokenLines, StringWidth) DEFINE_ACTION_FUNCTION(DBrokenLines, StringAt) { + PARAM_SELF_PROLOGUE(DBrokenLines); PARAM_INT(index); ACTION_RETURN_STRING((unsigned)index >= self->mBroken.Size() ? -1 : self->mBroken[index].Text);