History

Lua 5.1.1-rc3

Lua Team committed 20 years ago

Commit 90120a81 parent c9e49984 files · +18 −14Browse files

Showing the changes to src (3 of 4 files). Show all

Unified · Split

3 files
  1. src/ldo.c +4 −3
  2. src/lparser.c +6 −5
  3. src/lvm.c +2 −1
src/ldo.c+4−3
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldo.c,v 2.37 2005/12/22 16:19:56 roberto Exp $2** $Id: ldo.c,v 2.38 2006/06/05 19:36:14 roberto Exp $
3** Stack and Call structure of Lua3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -383,12 +383,14 @@ void luaD_call (lua_State *L, StkId func, int nResults) { · 377 unmodified lines
383static void resume (lua_State *L, void *ud) {383static void resume (lua_State *L, void *ud) {
384 StkId firstArg = cast(StkId, ud);384 StkId firstArg = cast(StkId, ud);
385 CallInfo *ci = L->ci;385 CallInfo *ci = L->ci;
386 if (L->status != LUA_YIELD) { /* start coroutine */386 if (L->status == 0) { /* start coroutine? */
387 lua_assert(ci == L->base_ci && firstArg > L->base);387 lua_assert(ci == L->base_ci && firstArg > L->base);
388 if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)388 if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)
389 return;389 return;
390 }390 }
391 else { /* resuming from previous yield */391 else { /* resuming from previous yield */
392 lua_assert(L->status == LUA_YIELD);
393 L->status = 0;
392 if (!f_isLua(ci)) { /* `common' yield? */394 if (!f_isLua(ci)) { /* `common' yield? */
393 /* finish interrupted execution of `OP_CALL' */395 /* finish interrupted execution of `OP_CALL' */
394 lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||396 lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||
@@ -399,7 +401,6 @@ static void resume (lua_State *L, void *ud) { · 4 unmodified lines
399 else /* yielded inside a hook: just continue its execution */401 else /* yielded inside a hook: just continue its execution */
400 L->base = L->ci->base;402 L->base = L->ci->base;
401 }403 }
402 L->status = 0;
403 luaV_execute(L, cast_int(L->ci - L->base_ci));404 luaV_execute(L, cast_int(L->ci - L->base_ci));
404}405}
405 406
src/lparser.c+6−5
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lparser.c,v 2.41 2006/03/09 18:15:48 roberto Exp $2** $Id: lparser.c,v 2.42 2006/06/05 15:57:59 roberto Exp $
3** Lua Parser3** Lua Parser
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -299,7 +299,8 @@ static void leaveblock (FuncState *fs) { · 293 unmodified lines
299 removevars(fs->ls, bl->nactvar);299 removevars(fs->ls, bl->nactvar);
300 if (bl->upval)300 if (bl->upval)
301 luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);301 luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
302 lua_assert(!bl->isbreakable || !bl->upval); /* loops have no body */302 /* a block either controls scope or breaks (never both) */
303 lua_assert(!bl->isbreakable || !bl->upval);
303 lua_assert(bl->nactvar == fs->nactvar);304 lua_assert(bl->nactvar == fs->nactvar);
304 fs->freereg = fs->nactvar; /* free registers */305 fs->freereg = fs->nactvar; /* free registers */
305 luaK_patchtohere(fs, bl->breaklist);306 luaK_patchtohere(fs, bl->breaklist);
@@ -444,6 +445,7 @@ static void recfield (LexState *ls, struct ConsControl *cc) { · 138 unmodified lines
444 FuncState *fs = ls->fs;445 FuncState *fs = ls->fs;
445 int reg = ls->fs->freereg;446 int reg = ls->fs->freereg;
446 expdesc key, val;447 expdesc key, val;
448 int rkkey;
447 if (ls->t.token == TK_NAME) {449 if (ls->t.token == TK_NAME) {
448 luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor");450 luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor");
449 checkname(ls, &key);451 checkname(ls, &key);
@@ -452,10 +454,9 @@ static void recfield (LexState *ls, struct ConsControl *cc) { · 2 unmodified lines
452 yindex(ls, &key);454 yindex(ls, &key);
453 cc->nh++;455 cc->nh++;
454 checknext(ls, '=');456 checknext(ls, '=');
455 luaK_exp2RK(fs, &key);457 rkkey = luaK_exp2RK(fs, &key);
456 expr(ls, &val);458 expr(ls, &val);
457 luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, luaK_exp2RK(fs, &key),459 luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val));
458 luaK_exp2RK(fs, &val));
459 fs->freereg = reg; /* free registers */460 fs->freereg = reg; /* free registers */
460}461}
461 462
src/lvm.c+2−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lvm.c,v 2.62 2006/01/23 19:51:43 roberto Exp $2** $Id: lvm.c,v 2.63 2006/06/05 15:58:59 roberto Exp $
3** Lua virtual machine3** Lua virtual machine
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -376,6 +376,7 @@ void luaV_execute (lua_State *L, int nexeccalls) { · 370 unmodified lines
376 TValue *k;376 TValue *k;
377 const Instruction *pc;377 const Instruction *pc;
378 reentry: /* entry point */378 reentry: /* entry point */
379 lua_assert(isLua(L->ci));
379 pc = L->savedpc;380 pc = L->savedpc;
380 cl = &clvalue(L->ci->func)->l;381 cl = &clvalue(L->ci->func)->l;
381 base = L->base;382 base = L->base;