committed OP_LCTRL for some reason
added setpos() to JIT helpers --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4083
This commit is contained in:
parent
6e15ece954
commit
240d29846c
@ -75,6 +75,10 @@ public:
|
||||
{
|
||||
return (outptr - outbase);
|
||||
}
|
||||
inline void setpos(jitoffs_t offs)
|
||||
{
|
||||
outptr = outbase + offs;
|
||||
}
|
||||
public:
|
||||
cell_t *inptr; /* input pointer */
|
||||
jitcode_t outbase; /* output pointer */
|
||||
|
@ -1104,6 +1104,66 @@ inline void WriteOp_Lidx_B(JitWriter *jit)
|
||||
IA32_Mov_Reg_Rm_Disp_Reg(jit, AMX_REG_PRI, AMX_REG_DAT, AMX_REG_PRI, NOSCALE);
|
||||
}
|
||||
|
||||
inline void WriteOp_Lctrl(JitWriter *jit)
|
||||
{
|
||||
cell_t val = jit->read_cell();
|
||||
switch (val)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
//mov ecx, [esi+ctx]
|
||||
//mov eax, [ecx+<offs>]
|
||||
IA32_Mov_Reg_Rm_Disp8(jit, REG_ECX, AMX_REG_INFO, AMX_INFO_CONTEXT);
|
||||
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_PRI, REG_ECX, offsetof(sp_context_t, base));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
//mov eax, edi
|
||||
IA32_Mov_Reg_Rm(jit, AMX_REG_PRI, AMX_REG_DAT, MOD_REG);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
//mov eax, [esi+hea]
|
||||
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_PRI, AMX_REG_INFO, AMX_INFO_HEAP);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
//mov ecx, [esi+ctx]
|
||||
//mov eax, [ecx+ctx.memory]
|
||||
IA32_Mov_Reg_Rm_Disp8(jit, REG_ECX, AMX_REG_INFO, AMX_INFO_CONTEXT);
|
||||
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_PRI, REG_ECX, offsetof(sp_context_t, memory));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
//mov eax, ebp
|
||||
//sub eax, edi - unrelocate
|
||||
IA32_Mov_Reg_Rm(jit, AMX_REG_PRI, AMX_REG_STK, MOD_REG);
|
||||
IA32_Sub_Rm_Reg(jit, AMX_REG_PRI, AMX_REG_DAT, MOD_REG);
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
//mov eax, [esi+frm]
|
||||
IA32_Mov_Reg_Rm_Disp8(jit, AMX_REG_PRI, AMX_REG_INFO, AMX_INFO_FRM);
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
//mov eax, [cip]
|
||||
jitoffs_t imm32 = IA32_Mov_Reg_Imm32(jit, AMX_REG_PRI, 0);
|
||||
jitoffs_t save = jit->jit_curpos();
|
||||
jit->setpos(imm32);
|
||||
jit->write_int32((uint32_t)(jit->outbase + save));
|
||||
jit->setpos(save);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
*************************************************
|
||||
* JIT PROPER ************************************
|
||||
@ -1793,6 +1853,11 @@ IPluginContext *JITX86::CompileToContext(ICompilation *co, int *err)
|
||||
WriteOp_Idxaddr_B(jit);
|
||||
break;
|
||||
}
|
||||
case OP_LCTRL:
|
||||
{
|
||||
WriteOp_Lctrl(jit);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
AbortCompilation(co);
|
||||
|
@ -63,7 +63,7 @@ typedef enum
|
||||
OP_IDXADDR_B, //DONE
|
||||
OP_ALIGN_PRI, //DONE
|
||||
OP_ALIGN_ALT, //DONE
|
||||
OP_LCTRL,
|
||||
OP_LCTRL, //DONE
|
||||
OP_SCTRL,
|
||||
OP_MOVE_PRI, //DONE
|
||||
OP_MOVE_ALT, //DONE
|
||||
|
@ -650,10 +650,13 @@ inline void IA32_Mov_Rm16_Reg_Disp_Reg(JitWriter *jit,
|
||||
* Moving from IMMEDIATE to REGISTER
|
||||
*/
|
||||
|
||||
inline void IA32_Mov_Reg_Imm32(JitWriter *jit, jit_uint8_t dest, jit_int32_t num)
|
||||
inline jitoffs_t IA32_Mov_Reg_Imm32(JitWriter *jit, jit_uint8_t dest, jit_int32_t num)
|
||||
{
|
||||
jitoffs_t offs;
|
||||
jit->write_ubyte(IA32_MOV_REG_IMM+dest);
|
||||
offs = jit->jit_curpos();
|
||||
jit->write_int32(num);
|
||||
return offs;
|
||||
}
|
||||
|
||||
inline void IA32_Mov_Rm_Imm32_Disp8(JitWriter *jit,
|
||||
|
Loading…
Reference in New Issue
Block a user