diff options
author | Mike Pall <mike> | 2011-01-09 17:48:25 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-01-09 17:57:19 +0100 |
commit | 9502afb35b47ca90e52516721abd1ebf273e539e (patch) | |
tree | aff73d3b11d5950ef17c927624bb676cf43d0108 /src | |
parent | 06f99fc3dfa5da1fb9de7210b8a0ce772745a375 (diff) | |
download | luajit-9502afb35b47ca90e52516721abd1ebf273e539e.tar.gz luajit-9502afb35b47ca90e52516721abd1ebf273e539e.tar.bz2 luajit-9502afb35b47ca90e52516721abd1ebf273e539e.zip |
FFI: Preserve stack top across implicit load of FFI library in lexer.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.dep | 2 | ||||
-rw-r--r-- | src/lj_lex.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Makefile.dep b/src/Makefile.dep index 9982f7b0..8481b9f0 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep | |||
@@ -97,7 +97,7 @@ lj_ir.o: lj_ir.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ | |||
97 | lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_lib.h | 97 | lj_bc.h lj_traceerr.h lj_ctype.h lj_cdata.h lj_lib.h |
98 | lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ | 98 | lj_lex.o: lj_lex.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h lj_gc.h \ |
99 | lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \ | 99 | lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_ctype.h lj_cdata.h lualib.h \ |
100 | lj_lex.h lj_parse.h lj_char.h | 100 | lj_state.h lj_lex.h lj_parse.h lj_char.h |
101 | lj_lib.o: lj_lib.c lauxlib.h lua.h luaconf.h lj_obj.h lj_def.h lj_arch.h \ | 101 | lj_lib.o: lj_lib.c lauxlib.h lua.h luaconf.h lj_obj.h lj_def.h lj_arch.h \ |
102 | lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h lj_bc.h \ | 102 | lj_gc.h lj_err.h lj_errmsg.h lj_str.h lj_tab.h lj_func.h lj_bc.h \ |
103 | lj_dispatch.h lj_jit.h lj_ir.h lj_vm.h lj_lib.h | 103 | lj_dispatch.h lj_jit.h lj_ir.h lj_vm.h lj_lib.h |
diff --git a/src/lj_lex.c b/src/lj_lex.c index c97d6e0e..ac0d1e95 100644 --- a/src/lj_lex.c +++ b/src/lj_lex.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "lj_cdata.h" | 19 | #include "lj_cdata.h" |
20 | #include "lualib.h" | 20 | #include "lualib.h" |
21 | #endif | 21 | #endif |
22 | #include "lj_state.h" | ||
22 | #include "lj_lex.h" | 23 | #include "lj_lex.h" |
23 | #include "lj_parse.h" | 24 | #include "lj_parse.h" |
24 | #include "lj_char.h" | 25 | #include "lj_char.h" |
@@ -87,6 +88,7 @@ static void inclinenumber(LexState *ls) | |||
87 | /* Load FFI library on-demand. Needed if we create cdata objects. */ | 88 | /* Load FFI library on-demand. Needed if we create cdata objects. */ |
88 | static void lex_loadffi(lua_State *L) | 89 | static void lex_loadffi(lua_State *L) |
89 | { | 90 | { |
91 | ptrdiff_t oldtop = savestack(L, L->top); | ||
90 | cTValue *tmp; | 92 | cTValue *tmp; |
91 | luaopen_ffi(L); | 93 | luaopen_ffi(L); |
92 | tmp = lj_tab_getstr(tabV(registry(L)), lj_str_newlit(L, "_LOADED")); | 94 | tmp = lj_tab_getstr(tabV(registry(L)), lj_str_newlit(L, "_LOADED")); |
@@ -95,7 +97,7 @@ static void lex_loadffi(lua_State *L) | |||
95 | copyTV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "ffi")), L->top-1); | 97 | copyTV(L, lj_tab_setstr(L, t, lj_str_newlit(L, "ffi")), L->top-1); |
96 | lj_gc_anybarriert(L, t); | 98 | lj_gc_anybarriert(L, t); |
97 | } | 99 | } |
98 | L->top--; | 100 | L->top = restorestack(L, oldtop); |
99 | } | 101 | } |
100 | 102 | ||
101 | /* Parse 64 bit integer. */ | 103 | /* Parse 64 bit integer. */ |