aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2024-08-15 00:19:35 +0200
committerMike Pall <mike>2024-08-15 00:19:35 +0200
commit833600390cb34d2e1d3f05b8eae8bebf9fd7a873 (patch)
tree8ec4efc21a4a11e5dedb49a58f2ef3b418038172
parent04dca7911ea255f37be799c18d74c305b921c1a6 (diff)
parent86e7123bb1782a5f200ba5e83b8c4f3fbad4f7bc (diff)
downloadluajit-833600390cb34d2e1d3f05b8eae8bebf9fd7a873.tar.gz
luajit-833600390cb34d2e1d3f05b8eae8bebf9fd7a873.tar.bz2
luajit-833600390cb34d2e1d3f05b8eae8bebf9fd7a873.zip
Merge branch 'master' into v2.1
-rw-r--r--src/lj_opt_fold.c16
-rw-r--r--src/lj_record.c5
-rw-r--r--src/lj_snap.c3
-rw-r--r--src/lj_trace.c4
4 files changed, 20 insertions, 8 deletions
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c
index ce78505b..62483c26 100644
--- a/src/lj_opt_fold.c
+++ b/src/lj_opt_fold.c
@@ -1935,9 +1935,10 @@ LJFOLDF(abc_k)
1935LJFOLD(ABC any any) 1935LJFOLD(ABC any any)
1936LJFOLDF(abc_invar) 1936LJFOLDF(abc_invar)
1937{ 1937{
1938 /* Invariant ABC marked as PTR. Drop if op1 is invariant, too. */ 1938 /* Invariant ABC marked as P32 or U32. Drop if op1 is invariant too. */
1939 if (!irt_isint(fins->t) && fins->op1 < J->chain[IR_LOOP] && 1939 if (!irt_isint(fins->t) && fins->op1 < J->chain[IR_LOOP] &&
1940 !irt_isphi(IR(fins->op1)->t)) 1940 (irt_isu32(fins->t) ||
1941 (!irref_isk(fins->op1) && !irt_isphi(IR(fins->op1)->t))))
1941 return DROPFOLD; 1942 return DROPFOLD;
1942 return NEXTFOLD; 1943 return NEXTFOLD;
1943} 1944}
@@ -2485,6 +2486,17 @@ LJFOLD(CNEW any any)
2485LJFOLD(XSNEW any any) 2486LJFOLD(XSNEW any any)
2486LJFOLDX(lj_ir_emit) 2487LJFOLDX(lj_ir_emit)
2487 2488
2489/* -- Miscellaneous ------------------------------------------------------- */
2490
2491LJFOLD(CARG any any)
2492LJFOLDF(cse_carg)
2493{
2494 TRef tr = lj_opt_cse(J);
2495 if (tref_ref(tr) < J->chain[IR_LOOP]) /* CSE across loop? */
2496 return EMITFOLD; /* Raw emit. Assumes fins is left intact by CSE. */
2497 return tr;
2498}
2499
2488/* ------------------------------------------------------------------------ */ 2500/* ------------------------------------------------------------------------ */
2489 2501
2490/* Every entry in the generated hash table is a 32 bit pattern: 2502/* Every entry in the generated hash table is a 32 bit pattern:
diff --git a/src/lj_record.c b/src/lj_record.c
index 6666b3c6..3ba2ce8b 100644
--- a/src/lj_record.c
+++ b/src/lj_record.c
@@ -1395,12 +1395,13 @@ static void rec_idx_abc(jit_State *J, TRef asizeref, TRef ikey, uint32_t asize)
1395 /* Runtime value for stop of loop is within bounds? */ 1395 /* Runtime value for stop of loop is within bounds? */
1396 if ((uint64_t)stop + ofs < (uint64_t)asize) { 1396 if ((uint64_t)stop + ofs < (uint64_t)asize) {
1397 /* Emit invariant bounds check for stop. */ 1397 /* Emit invariant bounds check for stop. */
1398 emitir(IRTG(IR_ABC, IRT_P32), asizeref, ofs == 0 ? J->scev.stop : 1398 uint32_t abc = IRTG(IR_ABC, tref_isk(asizeref) ? IRT_U32 : IRT_P32);
1399 emitir(abc, asizeref, ofs == 0 ? J->scev.stop :
1399 emitir(IRTI(IR_ADD), J->scev.stop, ofsref)); 1400 emitir(IRTI(IR_ADD), J->scev.stop, ofsref));
1400 /* Emit invariant bounds check for start, if not const or negative. */ 1401 /* Emit invariant bounds check for start, if not const or negative. */
1401 if (!(J->scev.dir && J->scev.start && 1402 if (!(J->scev.dir && J->scev.start &&
1402 (int64_t)IR(J->scev.start)->i + ofs >= 0)) 1403 (int64_t)IR(J->scev.start)->i + ofs >= 0))
1403 emitir(IRTG(IR_ABC, IRT_P32), asizeref, ikey); 1404 emitir(abc, asizeref, ikey);
1404 return; 1405 return;
1405 } 1406 }
1406 } 1407 }
diff --git a/src/lj_snap.c b/src/lj_snap.c
index 6fda08ba..27f9c8e5 100644
--- a/src/lj_snap.c
+++ b/src/lj_snap.c
@@ -957,7 +957,8 @@ const BCIns *lj_snap_restore(jit_State *J, void *exptr)
957 lua_State *L = J->L; 957 lua_State *L = J->L;
958 958
959 /* Set interpreter PC to the next PC to get correct error messages. */ 959 /* Set interpreter PC to the next PC to get correct error messages. */
960 setcframe_pc(cframe_raw(L->cframe), pc+1); 960 setcframe_pc(L->cframe, pc+1);
961 setcframe_pc(cframe_raw(cframe_prev(L->cframe)), pc);
961 962
962 /* Make sure the stack is big enough for the slots from the snapshot. */ 963 /* Make sure the stack is big enough for the slots from the snapshot. */
963 if (LJ_UNLIKELY(L->base + snap->topslot >= tvref(L->maxstack))) { 964 if (LJ_UNLIKELY(L->base + snap->topslot >= tvref(L->maxstack))) {
diff --git a/src/lj_trace.c b/src/lj_trace.c
index f384cbdb..a5e316e1 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
@@ -905,10 +905,8 @@ int LJ_FASTCALL lj_trace_exit(jit_State *J, void *exptr)
905 exd.J = J; 905 exd.J = J;
906 exd.exptr = exptr; 906 exd.exptr = exptr;
907 errcode = lj_vm_cpcall(L, NULL, &exd, trace_exit_cp); 907 errcode = lj_vm_cpcall(L, NULL, &exd, trace_exit_cp);
908 if (errcode) { 908 if (errcode)
909 setcframe_pc(cframe_raw(L->cframe), L); /* Point to any valid memory. */
910 return -errcode; /* Return negated error code. */ 909 return -errcode; /* Return negated error code. */
911 }
912 910
913 if (exitcode) copyTV(L, L->top++, &exiterr); /* Anchor the error object. */ 911 if (exitcode) copyTV(L, L->top++, &exiterr); /* Anchor the error object. */
914 912