1
0
mirror of https://github.com/lua/lua.git synced 2025-01-14 05:43:00 +08:00

using jump tables when available

This commit is contained in:
Roberto Ierusalimschy 2018-03-02 15:59:19 -03:00
parent 893f382e94
commit 62a392ff46

15
lvm.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.347 2018/02/23 13:13:31 roberto Exp roberto $
** $Id: lvm.c,v 2.348 2018/02/26 14:16:05 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -31,6 +31,16 @@
#include "lvm.h"
/*
** By default, use jump tables in the main interpreter loop on gcc
** and compatible compilers.
*/
#if !defined(LUA_USE_JUMPTABLE)
#define LUA_USE_JUMPTABLE defined(__GNUC__)
#endif
/* limit for table tag-method chains (to avoid infinite loops) */
#define MAXTAGLOOP 2000
@ -871,6 +881,9 @@ void luaV_execute (lua_State *L, CallInfo *ci) {
StkId base;
const Instruction *pc;
int trap;
#if LUA_USE_JUMPTABLE
#include "ljumptab.h"
#endif
tailcall:
trap = L->hookmask;
cl = clLvalue(s2v(ci->func));