diff options
Diffstat (limited to 'apps/plugins/lua/lvm.c')
-rw-r--r-- | apps/plugins/lua/lvm.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/plugins/lua/lvm.c b/apps/plugins/lua/lvm.c index acce53a858..35a931d7a1 100644 --- a/apps/plugins/lua/lvm.c +++ b/apps/plugins/lua/lvm.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ | 2 | ** $Id: lvm.c,v 2.63.1.5 2011/08/17 20:43:11 roberto Exp $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -133,6 +133,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |||
133 | 133 | ||
134 | void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { | 134 | void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { |
135 | int loop; | 135 | int loop; |
136 | TValue temp; | ||
136 | for (loop = 0; loop < MAXTAGLOOP; loop++) { | 137 | for (loop = 0; loop < MAXTAGLOOP; loop++) { |
137 | const TValue *tm; | 138 | const TValue *tm; |
138 | if (ttistable(t)) { /* `t' is a table? */ | 139 | if (ttistable(t)) { /* `t' is a table? */ |
@@ -141,6 +142,7 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |||
141 | if (!ttisnil(oldval) || /* result is no nil? */ | 142 | if (!ttisnil(oldval) || /* result is no nil? */ |
142 | (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ | 143 | (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ |
143 | setobj2t(L, oldval, val); | 144 | setobj2t(L, oldval, val); |
145 | h->flags = 0; | ||
144 | luaC_barriert(L, h, val); | 146 | luaC_barriert(L, h, val); |
145 | return; | 147 | return; |
146 | } | 148 | } |
@@ -152,7 +154,9 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { | |||
152 | callTM(L, tm, t, key, val); | 154 | callTM(L, tm, t, key, val); |
153 | return; | 155 | return; |
154 | } | 156 | } |
155 | t = tm; /* else repeat with `tm' */ | 157 | /* else repeat with `tm' */ |
158 | setobj(L, &temp, tm); /* avoid pointing inside table (may rehash) */ | ||
159 | t = &temp; | ||
156 | } | 160 | } |
157 | luaG_runerror(L, "loop in settable"); | 161 | luaG_runerror(L, "loop in settable"); |
158 | } | 162 | } |
@@ -480,6 +484,7 @@ void luaV_execute (lua_State *L, int nexeccalls) { | |||
480 | continue; | 484 | continue; |
481 | } | 485 | } |
482 | case OP_DIV: { | 486 | case OP_DIV: { |
487 | /* ROCKLUA INTEGER BUGFIX */ | ||
483 | TValue *rb = RKB(i); | 488 | TValue *rb = RKB(i); |
484 | TValue *rc = RKC(i); | 489 | TValue *rc = RKC(i); |
485 | if (ttisnumber(rb) && ttisnumber(rc)) { | 490 | if (ttisnumber(rb) && ttisnumber(rc)) { |
@@ -495,6 +500,7 @@ void luaV_execute (lua_State *L, int nexeccalls) { | |||
495 | continue; | 500 | continue; |
496 | } | 501 | } |
497 | case OP_MOD: { | 502 | case OP_MOD: { |
503 | /* ROCKLUA INTEGER BUGFIX */ | ||
498 | TValue *rb = RKB(i); | 504 | TValue *rb = RKB(i); |
499 | TValue *rc = RKC(i); | 505 | TValue *rc = RKC(i); |
500 | if (ttisnumber(rb) && ttisnumber(rc)) { | 506 | if (ttisnumber(rb) && ttisnumber(rc)) { |
@@ -508,7 +514,7 @@ void luaV_execute (lua_State *L, int nexeccalls) { | |||
508 | Protect(Arith(L, ra, rb, rc, TM_MOD)); | 514 | Protect(Arith(L, ra, rb, rc, TM_MOD)); |
509 | 515 | ||
510 | continue; | 516 | continue; |
511 | } | 517 | } |
512 | case OP_POW: { | 518 | case OP_POW: { |
513 | arith_op(luai_numpow, TM_POW); | 519 | arith_op(luai_numpow, TM_POW); |
514 | continue; | 520 | continue; |