FFI: Load FFI library on-demand for -jdump.

This commit is contained in:
Mike Pall
2013-05-13 21:07:14 +02:00
parent acda75ad2c
commit 09ef8d1077
2 changed files with 14 additions and 3 deletions

View File

@@ -16,7 +16,11 @@
#include "lj_debug.h"
#include "lj_str.h"
#include "lj_tab.h"
#include "lj_state.h"
#include "lj_bc.h"
#if LJ_HASFFI
#include "lj_ctype.h"
#endif
#if LJ_HASJIT
#include "lj_ir.h"
#include "lj_jit.h"
@@ -332,6 +336,13 @@ LJLIB_CF(jit_util_tracek)
slot = ir->op2;
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);
}
#endif
lj_ir_kvalue(L, L->top-2, ir);
setintV(L->top-1, (int32_t)irt_type(ir->t));
if (slot == -1)