Skip to content

Commit

Permalink
Remove the JITX86 class.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvander committed Feb 24, 2015
1 parent c0ab66a commit 668b29c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 34 deletions.
2 changes: 1 addition & 1 deletion sourcepawn/jit/sp_vm_basecontext.cpp
Expand Up @@ -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;
}
Expand Down
40 changes: 17 additions & 23 deletions sourcepawn/jit/x86/jit_x86.cpp
Expand Up @@ -49,8 +49,6 @@ using namespace sp;

#define __ masm.

JITX86 g_Jit;

static inline ConditionCode
OpToCondition(OPCODE op)
{
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
12 changes: 2 additions & 10 deletions sourcepawn/jit/x86/jit_x86.h
Expand Up @@ -130,23 +130,15 @@ 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;
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_

0 comments on commit 668b29c

Please sign in to comment.