Add cross-32/64 bit and deterministic bytecode generation.
Contributed by Peter Cawley. #993 #1008
This commit is contained in:
18
src/lj_lib.c
18
src/lj_lib.c
@@ -62,6 +62,7 @@ static const uint8_t *lib_read_lfunc(lua_State *L, const uint8_t *p, GCtab *tab)
|
||||
ls.pe = (const char *)~(uintptr_t)0;
|
||||
ls.c = -1;
|
||||
ls.level = (BCDUMP_F_STRIP|(LJ_BE*BCDUMP_F_BE));
|
||||
ls.fr2 = LJ_FR2;
|
||||
ls.chunkname = name;
|
||||
pt = lj_bcread_proto(&ls);
|
||||
pt->firstline = ~(BCLine)0;
|
||||
@@ -266,6 +267,23 @@ GCfunc *lj_lib_checkfunc(lua_State *L, int narg)
|
||||
return funcV(o);
|
||||
}
|
||||
|
||||
GCproto *lj_lib_checkLproto(lua_State *L, int narg, int nolua)
|
||||
{
|
||||
TValue *o = L->base + narg-1;
|
||||
if (L->top > o) {
|
||||
if (tvisproto(o)) {
|
||||
return protoV(o);
|
||||
} else if (tvisfunc(o)) {
|
||||
if (isluafunc(funcV(o)))
|
||||
return funcproto(funcV(o));
|
||||
else if (nolua)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
lj_err_argt(L, narg, LUA_TFUNCTION);
|
||||
return NULL; /* unreachable */
|
||||
}
|
||||
|
||||
GCtab *lj_lib_checktab(lua_State *L, int narg)
|
||||
{
|
||||
TValue *o = L->base + narg-1;
|
||||
|
||||
Reference in New Issue
Block a user