aboutsummaryrefslogtreecommitdiff
path: root/src/lj_asm.c
diff options
context:
space:
mode:
authorMike Pall <mike>2021-07-19 16:23:12 +0200
committerMike Pall <mike>2021-07-19 16:23:12 +0200
commit6df650fe3fa0e06d9645524918a9935e3a282156 (patch)
treebc3487e71038a93d0f44afb4fd68f92c0553cec0 /src/lj_asm.c
parent71db0cf04357391beb01732af691a4df25298911 (diff)
downloadluajit-6df650fe3fa0e06d9645524918a9935e3a282156.tar.gz
luajit-6df650fe3fa0e06d9645524918a9935e3a282156.tar.bz2
luajit-6df650fe3fa0e06d9645524918a9935e3a282156.zip
String buffers, part 3a: Add IR_TMPREF for passing TValues to helpers.
Sponsored by fmad.io.
Diffstat (limited to 'src/lj_asm.c')
-rw-r--r--src/lj_asm.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index b613e6d3..ebcff43c 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -1144,7 +1144,7 @@ static void asm_gcstep(ASMState *as, IRIns *ir)
1144 1144
1145/* -- Buffer operations --------------------------------------------------- */ 1145/* -- Buffer operations --------------------------------------------------- */
1146 1146
1147static void asm_tvptr(ASMState *as, Reg dest, IRRef ref); 1147static void asm_tvptr(ASMState *as, Reg dest, IRRef ref, MSize mode);
1148 1148
1149static void asm_bufhdr(ASMState *as, IRIns *ir) 1149static void asm_bufhdr(ASMState *as, IRIns *ir)
1150{ 1150{
@@ -1218,7 +1218,7 @@ static void asm_bufput(ASMState *as, IRIns *ir)
1218 if (args[1] == ASMREF_TMP1) { 1218 if (args[1] == ASMREF_TMP1) {
1219 Reg tmp = ra_releasetmp(as, ASMREF_TMP1); 1219 Reg tmp = ra_releasetmp(as, ASMREF_TMP1);
1220 if (kchar == -129) 1220 if (kchar == -129)
1221 asm_tvptr(as, tmp, irs->op1); 1221 asm_tvptr(as, tmp, irs->op1, IRTMPREF_IN1);
1222 else 1222 else
1223 ra_allockreg(as, kchar, tmp); 1223 ra_allockreg(as, kchar, tmp);
1224 } 1224 }
@@ -1256,7 +1256,7 @@ static void asm_tostr(ASMState *as, IRIns *ir)
1256 asm_setupresult(as, ir, ci); /* GCstr * */ 1256 asm_setupresult(as, ir, ci); /* GCstr * */
1257 asm_gencall(as, ci, args); 1257 asm_gencall(as, ci, args);
1258 if (ir->op2 == IRTOSTR_NUM) 1258 if (ir->op2 == IRTOSTR_NUM)
1259 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op1); 1259 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op1, IRTMPREF_IN1);
1260} 1260}
1261 1261
1262#if LJ_32 && LJ_HASFFI && !LJ_SOFTFP && !LJ_TARGET_X86 1262#if LJ_32 && LJ_HASFFI && !LJ_SOFTFP && !LJ_TARGET_X86
@@ -1303,7 +1303,13 @@ static void asm_newref(ASMState *as, IRIns *ir)
1303 args[2] = ASMREF_TMP1; /* cTValue *key */ 1303 args[2] = ASMREF_TMP1; /* cTValue *key */
1304 asm_setupresult(as, ir, ci); /* TValue * */ 1304 asm_setupresult(as, ir, ci); /* TValue * */
1305 asm_gencall(as, ci, args); 1305 asm_gencall(as, ci, args);
1306 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op2); 1306 asm_tvptr(as, ra_releasetmp(as, ASMREF_TMP1), ir->op2, IRTMPREF_IN1);
1307}
1308
1309static void asm_tmpref(ASMState *as, IRIns *ir)
1310{
1311 Reg r = ra_dest(as, ir, RSET_GPR);
1312 asm_tvptr(as, r, ir->op1, ir->op2);
1307} 1313}
1308 1314
1309static void asm_lref(ASMState *as, IRIns *ir) 1315static void asm_lref(ASMState *as, IRIns *ir)
@@ -1785,6 +1791,7 @@ static void asm_ir(ASMState *as, IRIns *ir)
1785 case IR_NEWREF: asm_newref(as, ir); break; 1791 case IR_NEWREF: asm_newref(as, ir); break;
1786 case IR_UREFO: case IR_UREFC: asm_uref(as, ir); break; 1792 case IR_UREFO: case IR_UREFC: asm_uref(as, ir); break;
1787 case IR_FREF: asm_fref(as, ir); break; 1793 case IR_FREF: asm_fref(as, ir); break;
1794 case IR_TMPREF: asm_tmpref(as, ir); break;
1788 case IR_STRREF: asm_strref(as, ir); break; 1795 case IR_STRREF: asm_strref(as, ir); break;
1789 case IR_LREF: asm_lref(as, ir); break; 1796 case IR_LREF: asm_lref(as, ir); break;
1790 1797
@@ -2192,6 +2199,10 @@ static void asm_setup_regsp(ASMState *as)
2192 ir->prev = (uint16_t)REGSP_HINT((rload & 15)); 2199 ir->prev = (uint16_t)REGSP_HINT((rload & 15));
2193 rload = lj_ror(rload, 4); 2200 rload = lj_ror(rload, 4);
2194 continue; 2201 continue;
2202 case IR_TMPREF:
2203 if ((ir->op2 & IRTMPREF_OUT2) && as->evenspill < 4)
2204 as->evenspill = 4; /* TMPREF OUT2 needs two TValues on the stack. */
2205 break;
2195#endif 2206#endif
2196 case IR_CALLXS: { 2207 case IR_CALLXS: {
2197 CCallInfo ci; 2208 CCallInfo ci;