Portability cleanups for assembler backend.

This commit is contained in:
Mike Pall 2011-05-17 21:26:00 +02:00
parent 3168d9aa59
commit 3a942d6cea
3 changed files with 8 additions and 7 deletions

View File

@ -987,7 +987,7 @@ static void asm_head_root(ASMState *as)
{ {
int32_t spadj; int32_t spadj;
asm_head_root_base(as); asm_head_root_base(as);
emit_setgli(as, vmstate, (int32_t)as->T->traceno); emit_setvmstate(as, (int32_t)as->T->traceno);
spadj = asm_stack_adjust(as); spadj = asm_stack_adjust(as);
as->T->spadjust = (uint16_t)spadj; as->T->spadjust = (uint16_t)spadj;
emit_spsub(as, spadj); emit_spsub(as, spadj);
@ -1082,7 +1082,7 @@ static void asm_head_side(ASMState *as)
} }
/* Store trace number and adjust stack frame relative to the parent. */ /* Store trace number and adjust stack frame relative to the parent. */
emit_setgli(as, vmstate, (int32_t)as->T->traceno); emit_setvmstate(as, (int32_t)as->T->traceno);
emit_spsub(as, spdelta); emit_spsub(as, spdelta);
/* Restore target registers from parent spill slots. */ /* Restore target registers from parent spill slots. */
@ -1169,7 +1169,7 @@ static void asm_tail_link(ASMState *as)
pc = retpc; pc = retpc;
} }
emit_loada(as, RID_DISPATCH, J2GG(as->J)->dispatch); emit_loada(as, RID_DISPATCH, J2GG(as->J)->dispatch);
emit_loada(as, RID_PC, pc); emit_loada(as, RID_LPC, pc);
mres = (int32_t)(snap->nslots - baseslot); mres = (int32_t)(snap->nslots - baseslot);
switch (bc_op(*pc)) { switch (bc_op(*pc)) {
case BC_CALLM: case BC_CALLMT: case BC_CALLM: case BC_CALLMT:

View File

@ -261,8 +261,9 @@ static void emit_movmroi(ASMState *as, Reg base, int32_t ofs, int32_t i)
emit_rma(as, (xo), (r), (void *)&J2G(as->J)->field) emit_rma(as, (xo), (r), (void *)&J2G(as->J)->field)
#define emit_getgl(as, r, field) emit_opgl(as, XO_MOV, (r), field) #define emit_getgl(as, r, field) emit_opgl(as, XO_MOV, (r), field)
#define emit_setgl(as, r, field) emit_opgl(as, XO_MOVto, (r), field) #define emit_setgl(as, r, field) emit_opgl(as, XO_MOVto, (r), field)
#define emit_setgli(as, field, i) \
(emit_i32(as, i), emit_opgl(as, XO_MOVmi, 0, field)) #define emit_setvmstate(as, i) \
(emit_i32(as, i), emit_opgl(as, XO_MOVmi, 0, vmstate))
/* mov r, i / xor r, r */ /* mov r, i / xor r, r */
static void emit_loadi(ASMState *as, Reg r, int32_t i) static void emit_loadi(ASMState *as, Reg r, int32_t i)

View File

@ -43,10 +43,10 @@ enum {
/* These definitions must match with the *.dasc file(s): */ /* These definitions must match with the *.dasc file(s): */
RID_BASE = RID_EDX, /* Interpreter BASE. */ RID_BASE = RID_EDX, /* Interpreter BASE. */
#if LJ_64 && !LJ_ABI_WIN #if LJ_64 && !LJ_ABI_WIN
RID_PC = RID_EBX, /* Interpreter PC. */ RID_LPC = RID_EBX, /* Interpreter PC. */
RID_DISPATCH = RID_R14D, /* Interpreter DISPATCH table. */ RID_DISPATCH = RID_R14D, /* Interpreter DISPATCH table. */
#else #else
RID_PC = RID_ESI, /* Interpreter PC. */ RID_LPC = RID_ESI, /* Interpreter PC. */
RID_DISPATCH = RID_EBX, /* Interpreter DISPATCH table. */ RID_DISPATCH = RID_EBX, /* Interpreter DISPATCH table. */
#endif #endif