diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.113 2010/04/18 13:15:11 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.114 2010/04/18 13:22:48 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 | */ |
@@ -421,11 +421,13 @@ void luaV_finishOp (lua_State *L) { | |||
421 | (k + (GETARG_Bx(i) != 0 ? GETARG_Bx(i) - 1 : GETARG_Ax(*ci->u.l.savedpc++))) | 421 | (k + (GETARG_Bx(i) != 0 ? GETARG_Bx(i) - 1 : GETARG_Ax(*ci->u.l.savedpc++))) |
422 | 422 | ||
423 | 423 | ||
424 | #define dojump(i) { ci->u.l.savedpc += (i); luai_threadyield(L);} | 424 | #define dojump(i) (ci->u.l.savedpc += (i)) |
425 | 425 | ||
426 | 426 | ||
427 | #define Protect(x) { {x;}; base = ci->u.l.base; } | 427 | #define Protect(x) { {x;}; base = ci->u.l.base; } |
428 | 428 | ||
429 | #define checkGC(L) Protect(luaC_checkGC(L); luai_threadyield(L);) | ||
430 | |||
429 | 431 | ||
430 | #define arith_op(op,tm) { \ | 432 | #define arith_op(op,tm) { \ |
431 | TValue *rb = RKB(i); \ | 433 | TValue *rb = RKB(i); \ |
@@ -522,7 +524,7 @@ void luaV_execute (lua_State *L) { | |||
522 | sethvalue(L, ra, t); | 524 | sethvalue(L, ra, t); |
523 | if (b != 0 || c != 0) | 525 | if (b != 0 || c != 0) |
524 | luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); | 526 | luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); |
525 | Protect(luaC_checkGC(L)); | 527 | checkGC(L); |
526 | break; | 528 | break; |
527 | } | 529 | } |
528 | case OP_SELF: { | 530 | case OP_SELF: { |
@@ -579,7 +581,7 @@ void luaV_execute (lua_State *L) { | |||
579 | int b = GETARG_B(i); | 581 | int b = GETARG_B(i); |
580 | int c = GETARG_C(i); | 582 | int c = GETARG_C(i); |
581 | L->top = base + c + 1; /* mark the end of concat operands */ | 583 | L->top = base + c + 1; /* mark the end of concat operands */ |
582 | Protect(luaV_concat(L, c-b+1); luaC_checkGC(L)); | 584 | Protect(luaV_concat(L, c-b+1); checkGC(L);) |
583 | L->top = ci->top; /* restore top */ | 585 | L->top = ci->top; /* restore top */ |
584 | setobjs2s(L, RA(i), base+b); | 586 | setobjs2s(L, RA(i), base+b); |
585 | break; | 587 | break; |
@@ -776,7 +778,7 @@ void luaV_execute (lua_State *L) { | |||
776 | else /* get upvalue from enclosing function */ | 778 | else /* get upvalue from enclosing function */ |
777 | ncl->l.upvals[j] = cl->upvals[uv[j].idx]; | 779 | ncl->l.upvals[j] = cl->upvals[uv[j].idx]; |
778 | } | 780 | } |
779 | Protect(luaC_checkGC(L)); | 781 | checkGC(L); |
780 | break; | 782 | break; |
781 | } | 783 | } |
782 | case OP_VARARG: { | 784 | case OP_VARARG: { |