diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index 5b618a80..631321d9 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c @@ -799,8 +799,10 @@ void lj_ffrecord_func(jit_State *J) rd.argv = J->L->base; J->base[J->maxslot] = 0; /* Mark end of arguments. */ (recff_func[m >> 8])(J, &rd); /* Call recff_* handler. */ - if (rd.nres >= 0) + if (rd.nres >= 0) { + if (J->postproc == LJ_POST_NONE) J->postproc = LJ_POST_FFRETRY; lj_record_ret(J, 0, rd.nres); + } } #undef IR diff --git a/src/lj_jit.h b/src/lj_jit.h index e2dd5fb8..92631440 100644 --- a/src/lj_jit.h +++ b/src/lj_jit.h @@ -113,7 +113,8 @@ typedef enum { LJ_POST_NONE, /* No action. */ LJ_POST_FIXCOMP, /* Fixup comparison and emit pending guard. */ LJ_POST_FIXGUARD, /* Fixup and emit pending guard. */ - LJ_POST_FIXBOOL /* Fixup boolean result. */ + LJ_POST_FIXBOOL, /* Fixup boolean result. */ + LJ_POST_FFRETRY /* Suppress recording of retried fast functions. */ } PostProc; /* Machine code type. */ diff --git a/src/lj_record.c b/src/lj_record.c index cfdd3e1a..e20d142a 100644 --- a/src/lj_record.c +++ b/src/lj_record.c @@ -1400,6 +1400,10 @@ void lj_record_ins(jit_State *J) } } break; + case LJ_POST_FFRETRY: /* Suppress recording of retried fast function. */ + if (bc_op(*J->pc) >= BC__MAX) + return; + break; default: lua_assert(0); break; } J->postproc = LJ_POST_NONE;