Disable Lua 5.2 features by default. See -DLUAJIT_ENABLE_LUA52COMPAT.
This commit is contained in:
parent
ba602c9578
commit
57cd5026eb
@ -62,6 +62,11 @@ CCWARN= -Wall
|
|||||||
# Note that most of these are NOT suitable for benchmarking or release mode!
|
# Note that most of these are NOT suitable for benchmarking or release mode!
|
||||||
XCFLAGS=
|
XCFLAGS=
|
||||||
#
|
#
|
||||||
|
# Enable some upwards-compatible features from Lua 5.2 that are unlikely
|
||||||
|
# to break existing code (e.g. __pairs). Note that this does not provide
|
||||||
|
# full compatibility with Lua 5.2 at this time.
|
||||||
|
#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
|
||||||
|
#
|
||||||
# Disable the use of CMOV and FCOMI*/FUCOMI* instructions in the interpreter.
|
# Disable the use of CMOV and FCOMI*/FUCOMI* instructions in the interpreter.
|
||||||
# This is only necessary if you intend to run the code on REALLY ANCIENT CPUs
|
# This is only necessary if you intend to run the code on REALLY ANCIENT CPUs
|
||||||
# (before Pentium Pro, or on the VIA C3). This generally slows down the
|
# (before Pentium Pro, or on the VIA C3). This generally slows down the
|
||||||
|
@ -1098,11 +1098,16 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
| checktab TAB:CARG1
|
| checktab TAB:CARG1
|
||||||
| lwz PC, FRAME_PC(BASE)
|
| lwz PC, FRAME_PC(BASE)
|
||||||
| checkfail ->fff_fallback
|
| checkfail ->fff_fallback
|
||||||
|
#ifdef LUAJIT_ENABLE_LUA52COMPAT
|
||||||
| lwz TAB:TMP2, TAB:CARG1->metatable
|
| lwz TAB:TMP2, TAB:CARG1->metatable
|
||||||
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
|
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
|
||||||
| cmplwi TAB:TMP2, 0
|
| cmplwi TAB:TMP2, 0
|
||||||
| la RA, -8(BASE)
|
| la RA, -8(BASE)
|
||||||
| bne ->fff_fallback
|
| bne ->fff_fallback
|
||||||
|
#else
|
||||||
|
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
|
||||||
|
| la RA, -8(BASE)
|
||||||
|
#endif
|
||||||
| evstdd TAB:CARG1, 0(BASE)
|
| evstdd TAB:CARG1, 0(BASE)
|
||||||
| evstdd TISNIL, 8(BASE)
|
| evstdd TISNIL, 8(BASE)
|
||||||
| li RD, (3+1)*8
|
| li RD, (3+1)*8
|
||||||
@ -1153,11 +1158,16 @@ static void build_subroutines(BuildCtx *ctx)
|
|||||||
| checktab TAB:CARG1
|
| checktab TAB:CARG1
|
||||||
| lwz PC, FRAME_PC(BASE)
|
| lwz PC, FRAME_PC(BASE)
|
||||||
| checkfail ->fff_fallback
|
| checkfail ->fff_fallback
|
||||||
|
#ifdef LUAJIT_ENABLE_LUA52COMPAT
|
||||||
| lwz TAB:TMP2, TAB:CARG1->metatable
|
| lwz TAB:TMP2, TAB:CARG1->metatable
|
||||||
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
|
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
|
||||||
| cmplwi TAB:TMP2, 0
|
| cmplwi TAB:TMP2, 0
|
||||||
| la RA, -8(BASE)
|
| la RA, -8(BASE)
|
||||||
| bne ->fff_fallback
|
| bne ->fff_fallback
|
||||||
|
#else
|
||||||
|
| evldd CFUNC:TMP0, CFUNC:RB->upvalue[0]
|
||||||
|
| la RA, -8(BASE)
|
||||||
|
#endif
|
||||||
| evsplati TMP1, 0
|
| evsplati TMP1, 0
|
||||||
| evstdd TAB:CARG1, 0(BASE)
|
| evstdd TAB:CARG1, 0(BASE)
|
||||||
| evstdd TMP1, 8(BASE)
|
| evstdd TMP1, 8(BASE)
|
||||||
|
File diff suppressed because it is too large
Load Diff
2043
src/buildvm_x64.h
2043
src/buildvm_x64.h
File diff suppressed because it is too large
Load Diff
2060
src/buildvm_x64win.h
2060
src/buildvm_x64win.h
File diff suppressed because it is too large
Load Diff
@ -1511,7 +1511,9 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
|
|||||||
|.ffunc_1 pairs
|
|.ffunc_1 pairs
|
||||||
| mov TAB:RB, [BASE]
|
| mov TAB:RB, [BASE]
|
||||||
| cmp dword [BASE+4], LJ_TTAB; jne ->fff_fallback
|
| cmp dword [BASE+4], LJ_TTAB; jne ->fff_fallback
|
||||||
|
#ifdef LUAJIT_ENABLE_LUA52COMPAT
|
||||||
| cmp dword TAB:RB->metatable, 0; jne ->fff_fallback
|
| cmp dword TAB:RB->metatable, 0; jne ->fff_fallback
|
||||||
|
#endif
|
||||||
| mov CFUNC:RB, [BASE-8]
|
| mov CFUNC:RB, [BASE-8]
|
||||||
| mov CFUNC:RD, CFUNC:RB->upvalue[0]
|
| mov CFUNC:RD, CFUNC:RB->upvalue[0]
|
||||||
| mov PC, [BASE-4]
|
| mov PC, [BASE-4]
|
||||||
@ -1575,7 +1577,9 @@ static void build_subroutines(BuildCtx *ctx, int cmov, int sse)
|
|||||||
|.ffunc_1 ipairs
|
|.ffunc_1 ipairs
|
||||||
| mov TAB:RB, [BASE]
|
| mov TAB:RB, [BASE]
|
||||||
| cmp dword [BASE+4], LJ_TTAB; jne ->fff_fallback
|
| cmp dword [BASE+4], LJ_TTAB; jne ->fff_fallback
|
||||||
|
#ifdef LUAJIT_ENABLE_LUA52COMPAT
|
||||||
| cmp dword TAB:RB->metatable, 0; jne ->fff_fallback
|
| cmp dword TAB:RB->metatable, 0; jne ->fff_fallback
|
||||||
|
#endif
|
||||||
| mov CFUNC:RB, [BASE-8]
|
| mov CFUNC:RB, [BASE-8]
|
||||||
| mov CFUNC:RD, CFUNC:RB->upvalue[0]
|
| mov CFUNC:RD, CFUNC:RB->upvalue[0]
|
||||||
| mov PC, [BASE-4]
|
| mov PC, [BASE-4]
|
||||||
|
1271
src/buildvm_x86.h
1271
src/buildvm_x86.h
File diff suppressed because it is too large
Load Diff
@ -249,6 +249,7 @@ LJLIB_ASM(next)
|
|||||||
return FFH_UNREACHABLE;
|
return FFH_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LUAJIT_ENABLE_LUA52COMPAT
|
||||||
static int ffh_pairs(lua_State *L, MMS mm)
|
static int ffh_pairs(lua_State *L, MMS mm)
|
||||||
{
|
{
|
||||||
TValue *o = lj_lib_checkany(L, 1);
|
TValue *o = lj_lib_checkany(L, 1);
|
||||||
@ -264,6 +265,9 @@ static int ffh_pairs(lua_State *L, MMS mm)
|
|||||||
return FFH_RES(3);
|
return FFH_RES(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#define ffh_pairs(L, mm) (lj_lib_checktab(L, 1), FFH_UNREACHABLE)
|
||||||
|
#endif
|
||||||
|
|
||||||
LJLIB_PUSH(lastcl)
|
LJLIB_PUSH(lastcl)
|
||||||
LJLIB_ASM(pairs)
|
LJLIB_ASM(pairs)
|
||||||
|
@ -410,6 +410,12 @@ enum {
|
|||||||
#define setvmstate(g, st) ((g)->vmstate = ~LJ_VMST_##st)
|
#define setvmstate(g, st) ((g)->vmstate = ~LJ_VMST_##st)
|
||||||
|
|
||||||
/* Metamethods. */
|
/* Metamethods. */
|
||||||
|
#ifdef LUAJIT_ENABLE_LUA52COMPAT
|
||||||
|
#define MMDEF_52(_) _(pairs) _(ipairs)
|
||||||
|
#else
|
||||||
|
#define MMDEF_52(_)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MMDEF(_) \
|
#define MMDEF(_) \
|
||||||
_(index) _(newindex) _(gc) _(mode) _(eq) \
|
_(index) _(newindex) _(gc) _(mode) _(eq) \
|
||||||
/* Only the above (fast) metamethods are negative cached (max. 8). */ \
|
/* Only the above (fast) metamethods are negative cached (max. 8). */ \
|
||||||
@ -417,7 +423,7 @@ enum {
|
|||||||
/* The following must be in ORDER ARITH. */ \
|
/* The following must be in ORDER ARITH. */ \
|
||||||
_(add) _(sub) _(mul) _(div) _(mod) _(pow) _(unm) \
|
_(add) _(sub) _(mul) _(div) _(mod) _(pow) _(unm) \
|
||||||
/* The following are used in the standard libraries. */ \
|
/* The following are used in the standard libraries. */ \
|
||||||
_(metatable) _(tostring) _(pairs) _(ipairs)
|
_(metatable) _(tostring) MMDEF_52(_)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
#define MMENUM(name) MM_##name,
|
#define MMENUM(name) MM_##name,
|
||||||
|
@ -1426,7 +1426,10 @@ static void LJ_FASTCALL recff_ipairs_aux(jit_State *J, RecordFFData *rd)
|
|||||||
|
|
||||||
static void LJ_FASTCALL recff_ipairs(jit_State *J, RecordFFData *rd)
|
static void LJ_FASTCALL recff_ipairs(jit_State *J, RecordFFData *rd)
|
||||||
{
|
{
|
||||||
if (!recff_metacall(J, rd, MM_ipairs)) {
|
#ifdef LUAJIT_ENABLE_LUA52COMPAT
|
||||||
|
if (!recff_metacall(J, rd, MM_ipairs))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
TRef tab = J->base[0];
|
TRef tab = J->base[0];
|
||||||
if (tref_istab(tab)) {
|
if (tref_istab(tab)) {
|
||||||
J->base[0] = lj_ir_kfunc(J, funcV(&J->fn->c.upvalue[0]));
|
J->base[0] = lj_ir_kfunc(J, funcV(&J->fn->c.upvalue[0]));
|
||||||
|
Loading…
Reference in New Issue
Block a user