Remove the JITX86 class.

This commit is contained in:
David Anderson 2015-02-24 01:19:16 -08:00
parent 111dd7eb68
commit 781c5129a9
3 changed files with 20 additions and 34 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -130,15 +130,6 @@ class Compiler
ke::Vector<CallThunk *> 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_