diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-13 13:51:01 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-04-13 13:51:01 -0300 |
commit | e7c8393682f2977742cdac359cce9e558318aeac (patch) | |
tree | 4e3213fdea8c30dcf6f1d2b633eb1a54c755814e /lvm.c | |
parent | ceaa97ff5b78db364b1608ede26e3dba9050be0e (diff) | |
download | lua-e7c8393682f2977742cdac359cce9e558318aeac.tar.gz lua-e7c8393682f2977742cdac359cce9e558318aeac.tar.bz2 lua-e7c8393682f2977742cdac359cce9e558318aeac.zip |
optimization INCLOCAL is not necessary, with `for'
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 18 |
1 files changed, 3 insertions, 15 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.100 2000/04/07 13:13:11 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.101 2000/04/12 18:57:19 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 | */ |
@@ -500,19 +500,6 @@ StkId luaV_execute (lua_State *L, const Closure *cl, register StkId base) { | |||
500 | top--; | 500 | top--; |
501 | break; | 501 | break; |
502 | 502 | ||
503 | case OP_INCLOCAL: { | ||
504 | TObject *var = base+GETARG_B(i); | ||
505 | int n = GETARG_sA(i); | ||
506 | if (tonumber(var)) { | ||
507 | *top = *var; /* PUSHLOCAL */ | ||
508 | addK(L, top+1, n); | ||
509 | *var = *top; /* SETLOCAL */ | ||
510 | } | ||
511 | else | ||
512 | nvalue(var) += (Number)n; | ||
513 | break; | ||
514 | } | ||
515 | |||
516 | case OP_ADDI: | 503 | case OP_ADDI: |
517 | if (tonumber(top-1)) | 504 | if (tonumber(top-1)) |
518 | addK(L, top, GETARG_S(i)); | 505 | addK(L, top, GETARG_S(i)); |
@@ -647,7 +634,8 @@ StkId luaV_execute (lua_State *L, const Closure *cl, register StkId base) { | |||
647 | Number index; | 634 | Number index; |
648 | LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid step"); | 635 | LUA_ASSERT(L, ttype(top-1) == TAG_NUMBER, "invalid step"); |
649 | LUA_ASSERT(L, ttype(top-2) == TAG_NUMBER, "invalid limit"); | 636 | LUA_ASSERT(L, ttype(top-2) == TAG_NUMBER, "invalid limit"); |
650 | if (tonumber(top-3)) lua_error(L, "`for' index must be a number"); | 637 | if (ttype(top-3) != TAG_NUMBER) |
638 | lua_error(L, "`for' index must be a number"); | ||
651 | index = nvalue(top-3)+step; | 639 | index = nvalue(top-3)+step; |
652 | if ((step>0) ? index<=limit : index>=limit) { | 640 | if ((step>0) ? index<=limit : index>=limit) { |
653 | nvalue(top-3) = index; | 641 | nvalue(top-3) = index; |