aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/lvm.c b/lvm.c
index 99a04d07..3709d77a 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.266 2016/01/04 16:44:50 roberto Exp roberto $ 2** $Id: lvm.c,v 2.267 2016/01/05 16:07:21 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -752,6 +752,16 @@ void luaV_finishOp (lua_State *L) {
752 luai_threadyield(L); } 752 luai_threadyield(L); }
753 753
754 754
755/* fetch an instruction and prepare its execution */
756#define vmfetch() { \
757 i = *(ci->u.l.savedpc++); \
758 if (L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) \
759 Protect(luaG_traceexec(L)); \
760 ra = RA(i); /* WARNING: any stack reallocation invalidates 'ra' */ \
761 lua_assert(base == ci->u.l.base); \
762 lua_assert(base <= L->top && L->top < L->stack + L->stacksize); \
763}
764
755#define vmdispatch(o) switch(o) 765#define vmdispatch(o) switch(o)
756#define vmcase(l) case l: 766#define vmcase(l) case l:
757#define vmbreak break 767#define vmbreak break
@@ -786,14 +796,9 @@ void luaV_execute (lua_State *L) {
786 base = ci->u.l.base; /* local copy of function's base */ 796 base = ci->u.l.base; /* local copy of function's base */
787 /* main loop of interpreter */ 797 /* main loop of interpreter */
788 for (;;) { 798 for (;;) {
789 Instruction i = *(ci->u.l.savedpc++); 799 Instruction i;
790 StkId ra; 800 StkId ra;
791 if (L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) 801 vmfetch();
792 Protect(luaG_traceexec(L));
793 /* WARNING: several calls may realloc the stack and invalidate 'ra' */
794 ra = RA(i);
795 lua_assert(base == ci->u.l.base);
796 lua_assert(base <= L->top && L->top < L->stack + L->stacksize);
797 vmdispatch (GET_OPCODE(i)) { 802 vmdispatch (GET_OPCODE(i)) {
798 vmcase(OP_MOVE) { 803 vmcase(OP_MOVE) {
799 setobjs2s(L, ra, RB(i)); 804 setobjs2s(L, ra, RB(i));