String buffers, part 3a: Add IR_TMPREF for passing TValues to helpers.

Sponsored by fmad.io.
This commit is contained in:
Mike Pall
2021-07-19 16:23:12 +02:00
parent 71db0cf043
commit 6df650fe3f
12 changed files with 252 additions and 128 deletions

View File

@@ -259,6 +259,14 @@ TRef lj_record_constify(jit_State *J, cTValue *o)
return 0; /* Can't represent lightuserdata (pointless). */
}
/* Emit a VLOAD with the correct type. */
TRef lj_record_vload(jit_State *J, TRef ref, IRType t)
{
TRef tr = emitir(IRTG(IR_VLOAD, t), ref, 0);
if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */
return tr;
}
/* -- Record loop ops ----------------------------------------------------- */
/* Loop event. */
@@ -1832,9 +1840,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
IRType t = itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]);
TRef aref = emitir(IRT(IR_AREF, IRT_PGC),
vbase, lj_ir_kint(J, (int32_t)i));
TRef tr = emitir(IRTG(IR_VLOAD, t), aref, 0);
if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */
J->base[dst+i] = tr;
J->base[dst+i] = lj_record_vload(J, aref, t);
}
} else {
emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs));
@@ -1881,8 +1887,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
lj_ir_kint(J, frofs-(8<<LJ_FR2)));
t = itype2irt(&J->L->base[idx-2-LJ_FR2-nvararg]);
aref = emitir(IRT(IR_AREF, IRT_PGC), vbase, tridx);
tr = emitir(IRTG(IR_VLOAD, t), aref, 0);
if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */
tr = lj_record_vload(J, aref, t);
}
J->base[dst-2-LJ_FR2] = tr;
J->maxslot = dst-1-LJ_FR2;