diff options
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 12 |
1 files changed, 8 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.228 2002/05/02 13:06:20 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.229 2002/05/06 15:51:41 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 | */ |
| @@ -449,16 +449,21 @@ StkId luaV_execute (lua_State *L) { | |||
| 449 | } | 449 | } |
| 450 | case OP_EQ: { /* skip next instruction if test fails */ | 450 | case OP_EQ: { /* skip next instruction if test fails */ |
| 451 | if (luaO_equalObj(ra, RKC(i)) != GETARG_B(i)) pc++; | 451 | if (luaO_equalObj(ra, RKC(i)) != GETARG_B(i)) pc++; |
| 452 | else dojump(pc, GETARG_sBx(*pc) + 1); | ||
| 452 | break; | 453 | break; |
| 453 | } | 454 | } |
| 454 | case OP_CMP: { | 455 | case OP_CMP: { |
| 455 | if (!(luaV_cmp(L, ra, RKC(i), GETARG_B(i)))) pc++; | 456 | if (!(luaV_cmp(L, ra, RKC(i), GETARG_B(i)))) pc++; |
| 457 | else dojump(pc, GETARG_sBx(*pc) + 1); | ||
| 456 | break; | 458 | break; |
| 457 | } | 459 | } |
| 458 | case OP_TEST: { | 460 | case OP_TEST: { |
| 459 | StkId rc = RKC(i); | 461 | StkId rc = RKC(i); |
| 460 | if (l_isfalse(rc) == GETARG_B(i)) pc++; | 462 | if (l_isfalse(rc) == GETARG_B(i)) pc++; |
| 461 | else setobj(ra, rc); | 463 | else { |
| 464 | setobj(ra, rc); | ||
| 465 | dojump(pc, GETARG_sBx(*pc) + 1); | ||
| 466 | } | ||
| 462 | break; | 467 | break; |
| 463 | } | 468 | } |
| 464 | case OP_CALL: { | 469 | case OP_CALL: { |
| @@ -519,7 +524,6 @@ StkId luaV_execute (lua_State *L) { | |||
| 519 | } | 524 | } |
| 520 | case OP_FORLOOP: { | 525 | case OP_FORLOOP: { |
| 521 | lua_Number step, index, limit; | 526 | lua_Number step, index, limit; |
| 522 | int j = GETARG_sBx(i); | ||
| 523 | const TObject *plimit = ra+1; | 527 | const TObject *plimit = ra+1; |
| 524 | const TObject *pstep = ra+2; | 528 | const TObject *pstep = ra+2; |
| 525 | if (ttype(ra) != LUA_TNUMBER) | 529 | if (ttype(ra) != LUA_TNUMBER) |
| @@ -532,7 +536,7 @@ StkId luaV_execute (lua_State *L) { | |||
| 532 | index = nvalue(ra) + step; /* increment index */ | 536 | index = nvalue(ra) + step; /* increment index */ |
| 533 | limit = nvalue(plimit); | 537 | limit = nvalue(plimit); |
| 534 | if (step > 0 ? index <= limit : index >= limit) { | 538 | if (step > 0 ? index <= limit : index >= limit) { |
| 535 | dojump(pc, j); /* jump back */ | 539 | dojump(pc, GETARG_sBx(i)); /* jump back */ |
| 536 | chgnvalue(ra, index); /* update index */ | 540 | chgnvalue(ra, index); /* update index */ |
| 537 | } | 541 | } |
| 538 | break; | 542 | break; |
