Clean up INFO register structure (bug 5844 part 1, r=ds).
This commit is contained in:
parent
449617474b
commit
e3c45bd1f7
@ -1956,31 +1956,31 @@ bool CompData::SetOption(const char *key, const char *val)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int (*JIT_EXECUTE)(cell_t *vars, void *addr);
|
typedef int (*JIT_EXECUTE)(InfoVars *vars, void *addr);
|
||||||
int JITX86::InvokeFunction(BaseRuntime *runtime, JitFunction *fn, cell_t *result)
|
int JITX86::InvokeFunction(BaseRuntime *runtime, JitFunction *fn, cell_t *result)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
JIT_EXECUTE pfn;
|
JIT_EXECUTE pfn;
|
||||||
sp_context_t *ctx;
|
sp_context_t *ctx;
|
||||||
cell_t vars[AMX_NUM_INFO_VARS];
|
InfoVars vars;
|
||||||
|
|
||||||
ctx = runtime->GetBaseContext()->GetCtx();
|
ctx = runtime->GetBaseContext()->GetCtx();
|
||||||
|
|
||||||
vars[0] = ctx->sp;
|
vars.frm = ctx->sp;
|
||||||
vars[1] = ctx->hp;
|
vars.hp = ctx->hp;
|
||||||
vars[2] = (cell_t)result;
|
vars.rval = result;
|
||||||
vars[3] = (cell_t)ctx;
|
vars.ctx = ctx;
|
||||||
vars[4] = (cell_t)(runtime->plugin()->memory + runtime->plugin()->mem_size);
|
vars.stp = runtime->plugin()->memory + runtime->plugin()->mem_size;
|
||||||
vars[5] = fn->GetPCodeAddress();
|
vars.cip = fn->GetPCodeAddress();
|
||||||
vars[6] = runtime->plugin()->data_size;
|
vars.data_size = runtime->plugin()->data_size;
|
||||||
vars[7] = (cell_t)(runtime->plugin()->memory);
|
vars.memory = runtime->plugin()->memory;
|
||||||
/* vars[8] will be set to ESP */
|
/* vars.esp will be set in the entry code */
|
||||||
|
|
||||||
pfn = (JIT_EXECUTE)m_pJitEntry;
|
pfn = (JIT_EXECUTE)m_pJitEntry;
|
||||||
err = pfn(vars, fn->GetEntryAddress());
|
err = pfn(&vars, fn->GetEntryAddress());
|
||||||
|
|
||||||
ctx->hp = vars[1];
|
ctx->hp = vars.hp;
|
||||||
ctx->err_cip = vars[5];
|
ctx->err_cip = vars.cip;
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -206,17 +206,15 @@ struct InfoVars {
|
|||||||
void *esp;
|
void *esp;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define AMX_NUM_INFO_VARS 9
|
#define AMX_INFO_FRAME offsetof(InfoVars, frm)
|
||||||
|
#define AMX_INFO_HEAP offsetof(InfoVars, hp)
|
||||||
#define AMX_INFO_FRAME 0 //(same thing as above)
|
#define AMX_INFO_RETVAL offsetof(InfoVars, rval)
|
||||||
#define AMX_INFO_HEAP 4 //not relocated
|
#define AMX_INFO_CONTEXT offsetof(InfoVars, ctx)
|
||||||
#define AMX_INFO_RETVAL 8 //physical
|
#define AMX_INFO_STACKTOP offsetof(InfoVars, stp)
|
||||||
#define AMX_INFO_CONTEXT 12 //physical
|
#define AMX_INFO_CIP offsetof(InfoVars, cip)
|
||||||
#define AMX_INFO_STACKTOP 16 //relocated
|
#define AMX_INFO_DATASIZE offsetof(InfoVars, data_size)
|
||||||
#define AMX_INFO_CIP 20 //pcode CIP
|
#define AMX_INFO_MEMORY offsetof(InfoVars, memory)
|
||||||
#define AMX_INFO_DATASIZE 24 //plugin->data_size
|
#define AMX_INFO_NSTACK offsetof(InfoVars, esp)
|
||||||
#define AMX_INFO_MEMORY 28 //plugin->memory
|
|
||||||
#define AMX_INFO_NSTACK 32 //native stack
|
|
||||||
|
|
||||||
extern Knight::KeCodeCache *g_pCodeCache;
|
extern Knight::KeCodeCache *g_pCodeCache;
|
||||||
extern JITX86 g_Jit;
|
extern JITX86 g_Jit;
|
||||||
|
Loading…
Reference in New Issue
Block a user