MIPS: Fix trace linking.

This commit is contained in:
Mike Pall 2021-09-19 16:09:48 +02:00
parent 8ff09d9f5a
commit f2d333c1ac
6 changed files with 33 additions and 3 deletions

View File

@ -2550,7 +2550,9 @@ void lj_asm_trace(jit_State *J, GCtrace *T)
/* Set trace entry point before fixing up tail to allow link to self. */
T->mcode = as->mcp;
T->mcloop = as->mcloop ? (MSize)((char *)as->mcloop - (char *)as->mcp) : 0;
if (!as->loopref)
if (as->loopref)
asm_loop_tail_fixup(as);
else
asm_tail_fixup(as, T->link); /* Note: this may change as->mctop! */
T->szmcode = (MSize)((char *)as->mctop - (char *)as->mcp);
asm_snap_fixup_mcofs(as);

View File

@ -2129,6 +2129,12 @@ static void asm_loop_fixup(ASMState *as)
}
}
/* Fixup the tail of the loop. */
static void asm_loop_tail_fixup(ASMState *as)
{
UNUSED(as); /* Nothing to do. */
}
/* -- Head of trace ------------------------------------------------------- */
/* Reload L register from g->cur_L. */

View File

@ -1858,6 +1858,12 @@ static void asm_loop_fixup(ASMState *as)
}
}
/* Fixup the tail of the loop. */
static void asm_loop_tail_fixup(ASMState *as)
{
UNUSED(as); /* Nothing to do. */
}
/* -- Head of trace ------------------------------------------------------- */
/* Reload L register from g->cur_L. */

View File

@ -2640,6 +2640,12 @@ static void asm_loop_fixup(ASMState *as)
}
}
/* Fixup the tail of the loop. */
static void asm_loop_tail_fixup(ASMState *as)
{
if (as->loopinv) as->mctop--;
}
/* -- Head of trace ------------------------------------------------------- */
/* Coalesce BASE register for a root trace. */
@ -2647,7 +2653,6 @@ static void asm_head_root_base(ASMState *as)
{
IRIns *ir = IR(REF_BASE);
Reg r = ir->r;
if (as->loopinv) as->mctop--;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r) || irt_ismarked(ir->t))
@ -2662,7 +2667,6 @@ static RegSet asm_head_side_base(ASMState *as, IRIns *irp, RegSet allow)
{
IRIns *ir = IR(REF_BASE);
Reg r = ir->r;
if (as->loopinv) as->mctop--;
if (ra_hasreg(r)) {
ra_free(as, r);
if (rset_test(as->modset, r) || irt_ismarked(ir->t))

View File

@ -2157,6 +2157,12 @@ static void asm_loop_fixup(ASMState *as)
}
}
/* Fixup the tail of the loop. */
static void asm_loop_tail_fixup(ASMState *as)
{
UNUSED(as); /* Nothing to do. */
}
/* -- Head of trace ------------------------------------------------------- */
/* Coalesce BASE register for a root trace. */

View File

@ -2863,6 +2863,12 @@ static void asm_loop_fixup(ASMState *as)
}
}
/* Fixup the tail of the loop. */
static void asm_loop_tail_fixup(ASMState *as)
{
UNUSED(as); /* Nothing to do. */
}
/* -- Head of trace ------------------------------------------------------- */
/* Coalesce BASE register for a root trace. */