Merge branch 'master' into v2.1

This commit is contained in:
Mike Pall 2024-03-10 17:26:03 +01:00
commit 913df6a945
3 changed files with 7 additions and 1 deletions

View File

@ -1052,6 +1052,7 @@ LUA_API int lua_setmetatable(lua_State *L, int idx)
/* Flush cache, since traces specialize to basemt. But not during __gc. */ /* Flush cache, since traces specialize to basemt. But not during __gc. */
if (lj_trace_flushall(L)) if (lj_trace_flushall(L))
lj_err_caller(L, LJ_ERR_NOGCMM); lj_err_caller(L, LJ_ERR_NOGCMM);
o = index2adr(L, idx); /* Stack may have been reallocated. */
if (tvisbool(o)) { if (tvisbool(o)) {
/* NOBARRIER: basemt is a GC root. */ /* NOBARRIER: basemt is a GC root. */
setgcref(basemt_it(g, LJ_TTRUE), obj2gco(mt)); setgcref(basemt_it(g, LJ_TTRUE), obj2gco(mt));

View File

@ -108,6 +108,9 @@ static void gc_mark_start(global_State *g)
gc_markobj(g, tabref(mainthread(g)->env)); gc_markobj(g, tabref(mainthread(g)->env));
gc_marktv(g, &g->registrytv); gc_marktv(g, &g->registrytv);
gc_mark_gcroot(g); gc_mark_gcroot(g);
#if LJ_HASFFI
if (ctype_ctsG(g)) gc_markobj(g, ctype_ctsG(g)->finalizer);
#endif
g->gc.state = GCSpropagate; g->gc.state = GCSpropagate;
} }

View File

@ -948,7 +948,7 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
if ((pt->flags & PROTO_NOJIT)) if ((pt->flags & PROTO_NOJIT))
lj_trace_err(J, LJ_TRERR_CJITOFF); lj_trace_err(J, LJ_TRERR_CJITOFF);
if (J->framedepth == 0 && J->pt && frame == J->L->base - 1) { if (J->framedepth == 0 && J->pt && frame == J->L->base - 1) {
if (check_downrec_unroll(J, pt)) { if (!J->cur.root && check_downrec_unroll(J, pt)) {
J->maxslot = (BCReg)(rbase + gotresults); J->maxslot = (BCReg)(rbase + gotresults);
lj_snap_purge(J); lj_snap_purge(J);
lj_record_stop(J, LJ_TRLINK_DOWNREC, J->cur.traceno); /* Down-rec. */ lj_record_stop(J, LJ_TRLINK_DOWNREC, J->cur.traceno); /* Down-rec. */
@ -970,6 +970,8 @@ void lj_record_ret(jit_State *J, BCReg rbase, ptrdiff_t gotresults)
lj_trace_err(J, LJ_TRERR_LLEAVE); lj_trace_err(J, LJ_TRERR_LLEAVE);
} else if (J->needsnap) { /* Tailcalled to ff with side-effects. */ } else if (J->needsnap) { /* Tailcalled to ff with side-effects. */
lj_trace_err(J, LJ_TRERR_NYIRETL); /* No way to insert snapshot here. */ lj_trace_err(J, LJ_TRERR_NYIRETL); /* No way to insert snapshot here. */
} else if (1 + pt->framesize >= LJ_MAX_JSLOTS) {
lj_trace_err(J, LJ_TRERR_STACKOV);
} else { /* Return to lower frame. Guard for the target we return to. */ } else { /* Return to lower frame. Guard for the target we return to. */
TRef trpt = lj_ir_kgc(J, obj2gco(pt), IRT_PROTO); TRef trpt = lj_ir_kgc(J, obj2gco(pt), IRT_PROTO);
TRef trpc = lj_ir_kptr(J, (void *)frame_pc(frame)); TRef trpc = lj_ir_kptr(J, (void *)frame_pc(frame));