diff options
author | Mike Pall <mike> | 2024-01-22 19:06:36 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2024-01-22 19:06:36 +0100 |
commit | 4b90f6c4d7420139c135435e1580acb52ea18436 (patch) | |
tree | 1c3543b6baa4f8b30a33e8a624b60edc6feb0206 /src/lj_lib.c | |
parent | c525bcb9024510cad9e170e12b6209aedb330f83 (diff) | |
download | luajit-4b90f6c4d7420139c135435e1580acb52ea18436.tar.gz luajit-4b90f6c4d7420139c135435e1580acb52ea18436.tar.bz2 luajit-4b90f6c4d7420139c135435e1580acb52ea18436.zip |
Add cross-32/64 bit and deterministic bytecode generation.
Contributed by Peter Cawley. #993 #1008
Diffstat (limited to 'src/lj_lib.c')
-rw-r--r-- | src/lj_lib.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lj_lib.c b/src/lj_lib.c index ebe0dc78..06ae4fcf 100644 --- a/src/lj_lib.c +++ b/src/lj_lib.c | |||
@@ -62,6 +62,7 @@ static const uint8_t *lib_read_lfunc(lua_State *L, const uint8_t *p, GCtab *tab) | |||
62 | ls.pe = (const char *)~(uintptr_t)0; | 62 | ls.pe = (const char *)~(uintptr_t)0; |
63 | ls.c = -1; | 63 | ls.c = -1; |
64 | ls.level = (BCDUMP_F_STRIP|(LJ_BE*BCDUMP_F_BE)); | 64 | ls.level = (BCDUMP_F_STRIP|(LJ_BE*BCDUMP_F_BE)); |
65 | ls.fr2 = LJ_FR2; | ||
65 | ls.chunkname = name; | 66 | ls.chunkname = name; |
66 | pt = lj_bcread_proto(&ls); | 67 | pt = lj_bcread_proto(&ls); |
67 | pt->firstline = ~(BCLine)0; | 68 | pt->firstline = ~(BCLine)0; |
@@ -266,6 +267,23 @@ GCfunc *lj_lib_checkfunc(lua_State *L, int narg) | |||
266 | return funcV(o); | 267 | return funcV(o); |
267 | } | 268 | } |
268 | 269 | ||
270 | GCproto *lj_lib_checkLproto(lua_State *L, int narg, int nolua) | ||
271 | { | ||
272 | TValue *o = L->base + narg-1; | ||
273 | if (L->top > o) { | ||
274 | if (tvisproto(o)) { | ||
275 | return protoV(o); | ||
276 | } else if (tvisfunc(o)) { | ||
277 | if (isluafunc(funcV(o))) | ||
278 | return funcproto(funcV(o)); | ||
279 | else if (nolua) | ||
280 | return NULL; | ||
281 | } | ||
282 | } | ||
283 | lj_err_argt(L, narg, LUA_TFUNCTION); | ||
284 | return NULL; /* unreachable */ | ||
285 | } | ||
286 | |||
269 | GCtab *lj_lib_checktab(lua_State *L, int narg) | 287 | GCtab *lj_lib_checktab(lua_State *L, int narg) |
270 | { | 288 | { |
271 | TValue *o = L->base + narg-1; | 289 | TValue *o = L->base + narg-1; |