aboutsummaryrefslogtreecommitdiff
path: root/src/lj_record.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_record.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/lj_record.c b/src/lj_record.c
index 86f17abc..c0aea106 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -259,6 +259,14 @@ TRef lj_record_constify(jit_State *J, cTValue *o)
259 return 0; /* Can't represent lightuserdata (pointless). */ 259 return 0; /* Can't represent lightuserdata (pointless). */
260} 260}
261 261
262/* Emit a VLOAD with the correct type. */
263TRef lj_record_vload(jit_State *J, TRef ref, IRType t)
264{
265 TRef tr = emitir(IRTG(IR_VLOAD, t), ref, 0);
266 if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */
267 return tr;
268}
269
262/* -- Record loop ops ----------------------------------------------------- */ 270/* -- Record loop ops ----------------------------------------------------- */
263 271
264/* Loop event. */ 272/* Loop event. */
@@ -1832,9 +1840,7 @@ static void rec_varg(jit_State *J, BCReg dst, ptrdiff_t nresults)
1832 IRType t = itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]); 1840 IRType t = itype2irt(&J->L->base[i-1-LJ_FR2-nvararg]);
1833 TRef aref = emitir(IRT(IR_AREF, IRT_PGC), 1841 TRef aref = emitir(IRT(IR_AREF, IRT_PGC),
1834 vbase, lj_ir_kint(J, (int32_t)i)); 1842 vbase, lj_ir_kint(J, (int32_t)i));
1835 TRef tr = emitir(IRTG(IR_VLOAD, t), aref, 0); 1843 J->base[dst+i] = lj_record_vload(J, aref, t);
1836 if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */
1837 J->base[dst+i] = tr;
1838 } 1844 }
1839 } else { 1845 } else {
1840 emitir(IRTGI(IR_LE), fr, lj_ir_kint(J, frofs)); 1846 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)
1881 lj_ir_kint(J, frofs-(8<<LJ_FR2))); 1887 lj_ir_kint(J, frofs-(8<<LJ_FR2)));
1882 t = itype2irt(&J->L->base[idx-2-LJ_FR2-nvararg]); 1888 t = itype2irt(&J->L->base[idx-2-LJ_FR2-nvararg]);
1883 aref = emitir(IRT(IR_AREF, IRT_PGC), vbase, tridx); 1889 aref = emitir(IRT(IR_AREF, IRT_PGC), vbase, tridx);
1884 tr = emitir(IRTG(IR_VLOAD, t), aref, 0); 1890 tr = lj_record_vload(J, aref, t);
1885 if (irtype_ispri(t)) tr = TREF_PRI(t); /* Canonicalize primitives. */
1886 } 1891 }
1887 J->base[dst-2-LJ_FR2] = tr; 1892 J->base[dst-2-LJ_FR2] = tr;
1888 J->maxslot = dst-1-LJ_FR2; 1893 J->maxslot = dst-1-LJ_FR2;