Refactor IR_VLOAD to take an offset.

This commit is contained in:
Mike Pall
2021-09-19 17:18:16 +02:00
parent f2d333c1ac
commit 9211f0b03b
9 changed files with 19 additions and 13 deletions

View File

@@ -260,9 +260,9 @@ TRef lj_record_constify(jit_State *J, cTValue *o)
}
/* Emit a VLOAD with the correct type. */
TRef lj_record_vload(jit_State *J, TRef ref, IRType t)
TRef lj_record_vload(jit_State *J, TRef ref, MSize idx, IRType t)
{
TRef tr = emitir(IRTG(IR_VLOAD, t), ref, 0);
TRef tr = emitir(IRTG(IR_VLOAD, t), ref, idx);
if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */
return tr;
}
@@ -1848,9 +1848,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
vbase = emitir(IRT(IR_ADD, IRT_PGC), vbase, lj_ir_kint(J, frofs-8));
for (i = 0; i < nload; i++) {
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));
J->base[dst+i] = lj_record_vload(J, aref, t);
J->base[dst+i] = lj_record_vload(J, vbase, i, t);
}
} else {
emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs));
@@ -1897,7 +1895,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 = lj_record_vload(J, aref, t);
tr = lj_record_vload(J, aref, 0, t);
}
J->base[dst-2-LJ_FR2] = tr;
J->maxslot = dst-1-LJ_FR2;