diff --git a/sourcepawn/jit/sp_vm_basecontext.cpp b/sourcepawn/jit/sp_vm_basecontext.cpp index 8d14d54b73..7861738fa6 100644 --- a/sourcepawn/jit/sp_vm_basecontext.cpp +++ b/sourcepawn/jit/sp_vm_basecontext.cpp @@ -568,7 +568,7 @@ BaseContext::Execute2(IPluginFunction *function, const cell_t *params, unsigned if (fn) { m_pRuntime->m_PubJitFuncs[public_id] = fn; } else { - if ((fn = g_Jit.CompileFunction(m_pRuntime, cfun->Public()->code_offs, &ir)) == NULL) + if ((fn = CompileFunction(m_pRuntime, cfun->Public()->code_offs, &ir)) == NULL) return ir; m_pRuntime->m_PubJitFuncs[public_id] = fn; } diff --git a/sourcepawn/jit/x86/jit_x86.cpp b/sourcepawn/jit/x86/jit_x86.cpp index 5de146a375..8a413f14dc 100644 --- a/sourcepawn/jit/x86/jit_x86.cpp +++ b/sourcepawn/jit/x86/jit_x86.cpp @@ -49,8 +49,6 @@ using namespace sp; #define __ masm. -JITX86 g_Jit; - static inline ConditionCode OpToCondition(OPCODE op) { @@ -255,6 +253,22 @@ GetFunctionName(const sp_plugin_t *plugin, uint32_t offs) } #endif +CompiledFunction * +CompileFunction(PluginRuntime *prt, cell_t pcode_offs, int *err) +{ + Compiler cc(prt, pcode_offs); + CompiledFunction *fun = cc.emit(err); + if (!fun) + return NULL; + + // Grab the lock before linking code in, since the watchdog timer will look + // at this list on another thread. + ke::AutoLock lock(Environment::get()->lock()); + + prt->AddJittedFunction(fun); + return fun; +} + static int CompileFromThunk(PluginRuntime *runtime, cell_t pcode_offs, void **addrp, char *pc) { @@ -267,7 +281,7 @@ CompileFromThunk(PluginRuntime *runtime, cell_t pcode_offs, void **addrp, char * CompiledFunction *fn = runtime->GetJittedFunctionByOffset(pcode_offs); if (!fn) { int err; - fn = g_Jit.CompileFunction(runtime, pcode_offs, &err); + fn = CompileFunction(runtime, pcode_offs, &err); if (!fn) return err; } @@ -1789,23 +1803,3 @@ Compiler::emitErrorPaths() __ jmp(ExternalAddress(env_->stubs()->ReturnStub())); } } - -JITX86::JITX86() -{ -} - -CompiledFunction * -JITX86::CompileFunction(PluginRuntime *prt, cell_t pcode_offs, int *err) -{ - Compiler cc(prt, pcode_offs); - CompiledFunction *fun = cc.emit(err); - if (!fun) - return NULL; - - // Grab the lock before linking code in, since the watchdog timer will look - // at this list on another thread. - ke::AutoLock lock(Environment::get()->lock()); - - prt->AddJittedFunction(fun); - return fun; -} diff --git a/sourcepawn/jit/x86/jit_x86.h b/sourcepawn/jit/x86/jit_x86.h index ca5abb64bf..45e4aa0e37 100644 --- a/sourcepawn/jit/x86/jit_x86.h +++ b/sourcepawn/jit/x86/jit_x86.h @@ -130,15 +130,6 @@ class Compiler ke::Vector thunks_; //:TODO: free }; -class JITX86 -{ - public: - JITX86(); - - public: - CompiledFunction *CompileFunction(PluginRuntime *runtime, cell_t pcode_offs, int *err); -}; - const Register pri = eax; const Register alt = edx; const Register stk = edi; @@ -146,7 +137,8 @@ const Register dat = esi; const Register tmp = ecx; const Register frm = ebx; -extern JITX86 g_Jit; +CompiledFunction * +CompileFunction(PluginRuntime *prt, cell_t pcode_offs, int *err); #endif //_INCLUDE_SOURCEPAWN_JIT_X86_H_