diff --git a/src/lj_ir.h b/src/lj_ir.h index f33f6355..14b86165 100644 --- a/src/lj_ir.h +++ b/src/lj_ir.h @@ -194,6 +194,7 @@ IRFPMDEF(FPMENUM) _(STR_LEN, offsetof(GCstr, len)) \ _(FUNC_ENV, offsetof(GCfunc, l.env)) \ _(FUNC_PC, offsetof(GCfunc, l.pc)) \ + _(FUNC_FFID, offsetof(GCfunc, l.ffid)) \ _(THREAD_ENV, offsetof(lua_State, env)) \ _(TAB_META, offsetof(GCtab, metatable)) \ _(TAB_ARRAY, offsetof(GCtab, array)) \ diff --git a/src/lj_record.c b/src/lj_record.c index 9a3e3375..dbc096a2 100644 --- a/src/lj_record.c +++ b/src/lj_record.c @@ -648,7 +648,10 @@ static TRef rec_call_specialize(jit_State *J, GCfunc *fn, TRef tr) case FF_coroutine_wrap_aux: case FF_string_gmatch_aux: /* NYI: io_file_iter doesn't have an ffid, yet. */ - /* NYI: specialize to ffid? Not strictly necessary, trace will stop. */ + { /* Specialize to the ffid. */ + TRef trid = emitir(IRT(IR_FLOAD, IRT_U8), tr, IRFL_FUNC_FFID); + emitir(IRTG(IR_EQ, IRT_INT), trid, lj_ir_kint(J, fn->c.ffid)); + } return tr; default: /* NYI: don't specialize to non-monomorphic C functions. */