summaryrefslogtreecommitdiff
path: root/src/lj_bcread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_bcread.c')
-rw-r--r--src/lj_bcread.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lj_bcread.c b/src/lj_bcread.c
index dfef3947..de3c997a 100644
--- a/src/lj_bcread.c
+++ b/src/lj_bcread.c
@@ -15,6 +15,7 @@
15#if LJ_HASFFI 15#if LJ_HASFFI
16#include "lj_ctype.h" 16#include "lj_ctype.h"
17#include "lj_cdata.h" 17#include "lj_cdata.h"
18#include "lualib.h"
18#endif 19#endif
19#include "lj_lex.h" 20#include "lj_lex.h"
20#include "lj_bcdump.h" 21#include "lj_bcdump.h"
@@ -428,9 +429,18 @@ static int bcread_header(LexState *ls)
428 bcread_byte(ls) != BCDUMP_VERSION) return 0; 429 bcread_byte(ls) != BCDUMP_VERSION) return 0;
429 bcread_flags(ls) = flags = bcread_uleb128(ls); 430 bcread_flags(ls) = flags = bcread_uleb128(ls);
430 if ((flags & ~(BCDUMP_F_KNOWN)) != 0) return 0; 431 if ((flags & ~(BCDUMP_F_KNOWN)) != 0) return 0;
431#if !LJ_HASFFI 432 if ((flags & BCDUMP_F_FFI)) {
432 if ((flags & BCDUMP_F_FFI)) return 0; 433#if LJ_HASFFI
434 lua_State *L = ls->L;
435 if (!ctype_ctsG(G(L))) {
436 ptrdiff_t oldtop = savestack(L, L->top);
437 luaopen_ffi(L); /* Load FFI library on-demand. */
438 L->top = restorestack(L, oldtop);
439 }
440#else
441 return 0;
433#endif 442#endif
443 }
434 if ((flags & BCDUMP_F_STRIP)) { 444 if ((flags & BCDUMP_F_STRIP)) {
435 ls->chunkname = lj_str_newz(ls->L, ls->chunkarg); 445 ls->chunkname = lj_str_newz(ls->L, ls->chunkarg);
436 } else { 446 } else {