Abstract out on-demand loading of FFI library.

This commit is contained in:
Mike Pall
2021-06-01 01:01:15 +02:00
parent 61990cef05
commit 50d6883e60
4 changed files with 13 additions and 15 deletions

View File

@@ -346,11 +346,7 @@ LJLIB_CF(jit_util_tracek)
ir = &T->ir[ir->op1];
}
#if LJ_HASFFI
if (ir->o == IR_KINT64 && !ctype_ctsG(G(L))) {
ptrdiff_t oldtop = savestack(L, L->top);
luaopen_ffi(L); /* Load FFI library on-demand. */
L->top = restorestack(L, oldtop);
}
if (ir->o == IR_KINT64) ctype_loadffi(L);
#endif
lj_ir_kvalue(L, L->top-2, ir);
setintV(L->top-1, (int32_t)irt_type(ir->t));