Merge branch 'master' into v2.1

This commit is contained in:
Mike Pall
2025-07-24 15:41:35 +02:00
3 changed files with 9 additions and 6 deletions

View File

@@ -2084,7 +2084,8 @@ static void asm_intarith(ASMState *as, IRIns *ir, x86Arith xa)
RegSet allow = RSET_GPR; RegSet allow = RSET_GPR;
Reg dest, right; Reg dest, right;
int32_t k = 0; int32_t k = 0;
if (as->flagmcp == as->mcp) { /* Drop test r,r instruction. */ if (as->flagmcp == as->mcp && xa != XOg_X_IMUL) {
/* Drop test r,r instruction. */
MCode *p = as->mcp + ((LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2); MCode *p = as->mcp + ((LJ_64 && *as->mcp < XI_TESTb) ? 3 : 2);
MCode *q = p[0] == 0x0f ? p+1 : p; MCode *q = p[0] == 0x0f ? p+1 : p;
if ((*q & 15) < 14) { if ((*q & 15) < 14) {

View File

@@ -1261,6 +1261,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
if (ctype_isfunc(info)) { if (ctype_isfunc(info)) {
TRef func = emitir(IRT(IR_FLOAD, tp), J->base[0], IRFL_CDATA_PTR); TRef func = emitir(IRT(IR_FLOAD, tp), J->base[0], IRFL_CDATA_PTR);
CType *ctr = ctype_rawchild(cts, ct); CType *ctr = ctype_rawchild(cts, ct);
CTInfo ctr_info = ctr->info; /* crec_call_args may invalidate ctr. */
IRType t = crec_ct2irt(cts, ctr); IRType t = crec_ct2irt(cts, ctr);
TRef tr; TRef tr;
TValue tv; TValue tv;
@@ -1268,11 +1269,11 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
tv.u64 = ((uintptr_t)cdata_getptr(cdataptr(cd), (LJ_64 && tp == IRT_P64) ? 8 : 4) >> 2) | U64x(800000000, 00000000); tv.u64 = ((uintptr_t)cdata_getptr(cdataptr(cd), (LJ_64 && tp == IRT_P64) ? 8 : 4) >> 2) | U64x(800000000, 00000000);
if (tvistrue(lj_tab_get(J->L, cts->miscmap, &tv))) if (tvistrue(lj_tab_get(J->L, cts->miscmap, &tv)))
lj_trace_err(J, LJ_TRERR_BLACKL); lj_trace_err(J, LJ_TRERR_BLACKL);
if (ctype_isvoid(ctr->info)) { if (ctype_isvoid(ctr_info)) {
t = IRT_NIL; t = IRT_NIL;
rd->nres = 0; rd->nres = 0;
} else if (!(ctype_isnum(ctr->info) || ctype_isptr(ctr->info) || } else if (!(ctype_isnum(ctr_info) || ctype_isptr(ctr_info) ||
ctype_isenum(ctr->info)) || t == IRT_CDATA) { ctype_isenum(ctr_info)) || t == IRT_CDATA) {
lj_trace_err(J, LJ_TRERR_NYICALL); lj_trace_err(J, LJ_TRERR_NYICALL);
} }
if ((info & CTF_VARARG) if ((info & CTF_VARARG)
@@ -1283,7 +1284,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
func = emitir(IRT(IR_CARG, IRT_NIL), func, func = emitir(IRT(IR_CARG, IRT_NIL), func,
lj_ir_kint(J, ctype_typeid(cts, ct))); lj_ir_kint(J, ctype_typeid(cts, ct)));
tr = emitir(IRT(IR_CALLXS, t), crec_call_args(J, rd, cts, ct), func); tr = emitir(IRT(IR_CALLXS, t), crec_call_args(J, rd, cts, ct), func);
if (ctype_isbool(ctr->info)) { if (ctype_isbool(ctr_info)) {
if (frame_islua(J->L->base-1) && bc_b(frame_pc(J->L->base-1)[-1]) == 1) { if (frame_islua(J->L->base-1) && bc_b(frame_pc(J->L->base-1)[-1]) == 1) {
/* Don't check result if ignored. */ /* Don't check result if ignored. */
tr = TREF_NIL; tr = TREF_NIL;
@@ -1299,7 +1300,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
tr = TREF_TRUE; tr = TREF_TRUE;
} }
} else if (t == IRT_PTR || (LJ_64 && t == IRT_P32) || } else if (t == IRT_PTR || (LJ_64 && t == IRT_P32) ||
t == IRT_I64 || t == IRT_U64 || ctype_isenum(ctr->info)) { t == IRT_I64 || t == IRT_U64 || ctype_isenum(ctr_info)) {
TRef trid = lj_ir_kint(J, ctype_cid(info)); TRef trid = lj_ir_kint(J, ctype_cid(info));
tr = emitir(IRTG(IR_CNEWI, IRT_CDATA), trid, tr); tr = emitir(IRTG(IR_CNEWI, IRT_CDATA), trid, tr);
if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J); if (t == IRT_I64 || t == IRT_U64) lj_needsplit(J);

View File

@@ -101,6 +101,7 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
pt = funcproto(fn); pt = funcproto(fn);
pos = proto_bcpos(pt, ins) - 1; pos = proto_bcpos(pt, ins) - 1;
#if LJ_HASJIT #if LJ_HASJIT
if (pos == NO_BCPOS) return 1; /* Pretend it's the first bytecode. */
if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */ if (pos > pt->sizebc) { /* Undo the effects of lj_trace_exit for JLOOP. */
if (bc_isret(bc_op(ins[-1]))) { if (bc_isret(bc_op(ins[-1]))) {
GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins)); GCtrace *T = (GCtrace *)((char *)(ins-1) - offsetof(GCtrace, startins));