aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2026-03-04 11:20:47 +0100
committerMike Pall <mike>2026-03-04 11:20:47 +0100
commit659a61693aa3b87661864ad0f12eee14c865cd7f (patch)
tree6b7b6c5e735edb9e58e88dbd8f32282f2cbbf581 /src
parenta553b3de243b1ae07bdb21da4bdab77148793f76 (diff)
parent89f268b3f745dba80da6350d3cbbb0964f3fdbee (diff)
downloadluajit-659a61693aa3b87661864ad0f12eee14c865cd7f.tar.gz
luajit-659a61693aa3b87661864ad0f12eee14c865cd7f.tar.bz2
luajit-659a61693aa3b87661864ad0f12eee14c865cd7f.zip
Merge branch 'master' into v2.1
Diffstat (limited to 'src')
-rw-r--r--src/lj_ffrecord.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c
index 3c4d4eb5..edbf13cc 100644
--- a/src/lj_ffrecord.c
+++ b/src/lj_ffrecord.c
@@ -854,7 +854,7 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd)
854 } 854 }
855 trstart = recff_string_start(J, str, &start, trstart, trlen, tr0); 855 trstart = recff_string_start(J, str, &start, trstart, trlen, tr0);
856 if (rd->data) { /* Return string.sub result. */ 856 if (rd->data) { /* Return string.sub result. */
857 if (end - start >= 0) { 857 if (start <= end) {
858 /* Also handle empty range here, to avoid extra traces. */ 858 /* Also handle empty range here, to avoid extra traces. */
859 TRef trptr, trslen = emitir(IRTGI(IR_SUBOV), trend, trstart); 859 TRef trptr, trslen = emitir(IRTGI(IR_SUBOV), trend, trstart);
860 emitir(IRTGI(IR_GE), trslen, tr0); 860 emitir(IRTGI(IR_GE), trslen, tr0);
@@ -865,8 +865,8 @@ static void LJ_FASTCALL recff_string_range(jit_State *J, RecordFFData *rd)
865 J->base[0] = lj_ir_kstr(J, &J2G(J)->strempty); 865 J->base[0] = lj_ir_kstr(J, &J2G(J)->strempty);
866 } 866 }
867 } else { /* Return string.byte result(s). */ 867 } else { /* Return string.byte result(s). */
868 ptrdiff_t i, len = end - start; 868 if (start < end) {
869 if (len > 0) { 869 ptrdiff_t i, len = end - start;
870 TRef trslen = emitir(IRTGI(IR_SUBOV), trend, trstart); 870 TRef trslen = emitir(IRTGI(IR_SUBOV), trend, trstart);
871 emitir(IRTGI(IR_EQ), trslen, lj_ir_kint(J, (int32_t)len)); 871 emitir(IRTGI(IR_EQ), trslen, lj_ir_kint(J, (int32_t)len));
872 if (J->baseslot + len > LJ_MAX_JSLOTS) 872 if (J->baseslot + len > LJ_MAX_JSLOTS)