diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-07 13:37:10 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-07 13:37:10 -0200 |
commit | dff9be4224a1cd0f338b544b9e01d42f0f4e537f (patch) | |
tree | 1dc8846da882dd37d9f420c10ea545ce92fb3b8a | |
parent | 118347d8c3b83ea0291918e81c5367937316fabb (diff) | |
download | lua-dff9be4224a1cd0f338b544b9e01d42f0f4e537f.tar.gz lua-dff9be4224a1cd0f338b544b9e01d42f0f4e537f.tar.bz2 lua-dff9be4224a1cd0f338b544b9e01d42f0f4e537f.zip |
new macros to distinguish different types of object moves (for future GC
evolution).
-rw-r--r-- | lapi.c | 36 | ||||
-rw-r--r-- | ldebug.c | 10 | ||||
-rw-r--r-- | ldo.c | 26 | ||||
-rw-r--r-- | lgc.c | 4 | ||||
-rw-r--r-- | lobject.c | 6 | ||||
-rw-r--r-- | lobject.h | 19 | ||||
-rw-r--r-- | ltable.c | 18 | ||||
-rw-r--r-- | ltests.c | 4 | ||||
-rw-r--r-- | lvm.c | 68 |
9 files changed, 103 insertions, 88 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.215 2002/10/25 21:31:28 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.216 2002/11/06 19:08:00 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -84,7 +84,7 @@ static TObject *luaA_indexAcceptable (lua_State *L, int index) { | |||
84 | 84 | ||
85 | 85 | ||
86 | void luaA_pushobject (lua_State *L, const TObject *o) { | 86 | void luaA_pushobject (lua_State *L, const TObject *o) { |
87 | setobj(L->top, o); | 87 | setobj2s(L->top, o); |
88 | incr_top(L); | 88 | incr_top(L); |
89 | } | 89 | } |
90 | 90 | ||
@@ -111,7 +111,7 @@ LUA_API void lua_movethread (lua_State *from, lua_State *to, int n) { | |||
111 | api_checknelems(from, n); | 111 | api_checknelems(from, n); |
112 | from->top -= n; | 112 | from->top -= n; |
113 | for (i = 0; i < n; i++) { | 113 | for (i = 0; i < n; i++) { |
114 | setobj(to->top, from->top + i); | 114 | setobj2s(to->top, from->top + i); |
115 | api_incr_top(to); | 115 | api_incr_top(to); |
116 | } | 116 | } |
117 | lua_unlock(to); | 117 | lua_unlock(to); |
@@ -171,7 +171,7 @@ LUA_API void lua_remove (lua_State *L, int index) { | |||
171 | StkId p; | 171 | StkId p; |
172 | lua_lock(L); | 172 | lua_lock(L); |
173 | p = luaA_index(L, index); | 173 | p = luaA_index(L, index); |
174 | while (++p < L->top) setobj(p-1, p); | 174 | while (++p < L->top) setobjs2s(p-1, p); |
175 | L->top--; | 175 | L->top--; |
176 | lua_unlock(L); | 176 | lua_unlock(L); |
177 | } | 177 | } |
@@ -182,8 +182,8 @@ LUA_API void lua_insert (lua_State *L, int index) { | |||
182 | StkId q; | 182 | StkId q; |
183 | lua_lock(L); | 183 | lua_lock(L); |
184 | p = luaA_index(L, index); | 184 | p = luaA_index(L, index); |
185 | for (q = L->top; q>p; q--) setobj(q, q-1); | 185 | for (q = L->top; q>p; q--) setobjs2s(q, q-1); |
186 | setobj(p, L->top); | 186 | setobjs2s(p, L->top); |
187 | lua_unlock(L); | 187 | lua_unlock(L); |
188 | } | 188 | } |
189 | 189 | ||
@@ -191,7 +191,7 @@ LUA_API void lua_insert (lua_State *L, int index) { | |||
191 | LUA_API void lua_replace (lua_State *L, int index) { | 191 | LUA_API void lua_replace (lua_State *L, int index) { |
192 | lua_lock(L); | 192 | lua_lock(L); |
193 | api_checknelems(L, 1); | 193 | api_checknelems(L, 1); |
194 | setobj(luaA_index(L, index), L->top - 1); | 194 | setobj(luaA_index(L, index), L->top - 1); /* unknown destination */ |
195 | L->top--; | 195 | L->top--; |
196 | lua_unlock(L); | 196 | lua_unlock(L); |
197 | } | 197 | } |
@@ -199,7 +199,7 @@ LUA_API void lua_replace (lua_State *L, int index) { | |||
199 | 199 | ||
200 | LUA_API void lua_pushvalue (lua_State *L, int index) { | 200 | LUA_API void lua_pushvalue (lua_State *L, int index) { |
201 | lua_lock(L); | 201 | lua_lock(L); |
202 | setobj(L->top, luaA_index(L, index)); | 202 | setobj2s(L->top, luaA_index(L, index)); |
203 | api_incr_top(L); | 203 | api_incr_top(L); |
204 | lua_unlock(L); | 204 | lua_unlock(L); |
205 | } | 205 | } |
@@ -394,7 +394,7 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { | |||
394 | 394 | ||
395 | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { | 395 | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { |
396 | lua_lock(L); | 396 | lua_lock(L); |
397 | setsvalue(L->top, luaS_newlstr(L, s, len)); | 397 | setsvalue2s(L->top, luaS_newlstr(L, s, len)); |
398 | api_incr_top(L); | 398 | api_incr_top(L); |
399 | lua_unlock(L); | 399 | lua_unlock(L); |
400 | } | 400 | } |
@@ -469,11 +469,9 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { | |||
469 | 469 | ||
470 | LUA_API void lua_gettable (lua_State *L, int index) { | 470 | LUA_API void lua_gettable (lua_State *L, int index) { |
471 | StkId t; | 471 | StkId t; |
472 | const TObject *v; | ||
473 | lua_lock(L); | 472 | lua_lock(L); |
474 | t = luaA_index(L, index); | 473 | t = luaA_index(L, index); |
475 | v = luaV_gettable(L, t, L->top-1, 0); | 474 | setobj2s(L->top - 1, luaV_gettable(L, t, L->top - 1, 0)); |
476 | setobj(L->top - 1, v); | ||
477 | lua_unlock(L); | 475 | lua_unlock(L); |
478 | } | 476 | } |
479 | 477 | ||
@@ -483,7 +481,7 @@ LUA_API void lua_rawget (lua_State *L, int index) { | |||
483 | lua_lock(L); | 481 | lua_lock(L); |
484 | t = luaA_index(L, index); | 482 | t = luaA_index(L, index); |
485 | api_check(L, ttistable(t)); | 483 | api_check(L, ttistable(t)); |
486 | setobj(L->top - 1, luaH_get(hvalue(t), L->top - 1)); | 484 | setobj2s(L->top - 1, luaH_get(hvalue(t), L->top - 1)); |
487 | lua_unlock(L); | 485 | lua_unlock(L); |
488 | } | 486 | } |
489 | 487 | ||
@@ -493,7 +491,7 @@ LUA_API void lua_rawgeti (lua_State *L, int index, int n) { | |||
493 | lua_lock(L); | 491 | lua_lock(L); |
494 | o = luaA_index(L, index); | 492 | o = luaA_index(L, index); |
495 | api_check(L, ttistable(o)); | 493 | api_check(L, ttistable(o)); |
496 | setobj(L->top, luaH_getnum(hvalue(o), n)); | 494 | setobj2s(L->top, luaH_getnum(hvalue(o), n)); |
497 | api_incr_top(L); | 495 | api_incr_top(L); |
498 | lua_unlock(L); | 496 | lua_unlock(L); |
499 | } | 497 | } |
@@ -553,7 +551,7 @@ LUA_API void lua_getglobals (lua_State *L, int index) { | |||
553 | StkId o; | 551 | StkId o; |
554 | lua_lock(L); | 552 | lua_lock(L); |
555 | o = luaA_index(L, index); | 553 | o = luaA_index(L, index); |
556 | setobj(L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L)); | 554 | setobj2s(L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L)); |
557 | api_incr_top(L); | 555 | api_incr_top(L); |
558 | lua_unlock(L); | 556 | lua_unlock(L); |
559 | } | 557 | } |
@@ -581,7 +579,7 @@ LUA_API void lua_rawset (lua_State *L, int index) { | |||
581 | api_checknelems(L, 2); | 579 | api_checknelems(L, 2); |
582 | t = luaA_index(L, index); | 580 | t = luaA_index(L, index); |
583 | api_check(L, ttistable(t)); | 581 | api_check(L, ttistable(t)); |
584 | setobj(luaH_set(L, hvalue(t), L->top-2), L->top-1); | 582 | setobj2t(luaH_set(L, hvalue(t), L->top-2), L->top-1); |
585 | L->top -= 2; | 583 | L->top -= 2; |
586 | lua_unlock(L); | 584 | lua_unlock(L); |
587 | } | 585 | } |
@@ -593,7 +591,7 @@ LUA_API void lua_rawseti (lua_State *L, int index, int n) { | |||
593 | api_checknelems(L, 1); | 591 | api_checknelems(L, 1); |
594 | o = luaA_index(L, index); | 592 | o = luaA_index(L, index); |
595 | api_check(L, ttistable(o)); | 593 | api_check(L, ttistable(o)); |
596 | setobj(luaH_setnum(L, hvalue(o), n), L->top-1); | 594 | setobj2t(luaH_setnum(L, hvalue(o), n), L->top-1); |
597 | L->top--; | 595 | L->top--; |
598 | lua_unlock(L); | 596 | lua_unlock(L); |
599 | } | 597 | } |
@@ -787,7 +785,7 @@ LUA_API void lua_concat (lua_State *L, int n) { | |||
787 | luaC_checkGC(L); | 785 | luaC_checkGC(L); |
788 | } | 786 | } |
789 | else if (n == 0) { /* push empty string */ | 787 | else if (n == 0) { /* push empty string */ |
790 | setsvalue(L->top, luaS_newlstr(L, NULL, 0)); | 788 | setsvalue2s(L->top, luaS_newlstr(L, NULL, 0)); |
791 | api_incr_top(L); | 789 | api_incr_top(L); |
792 | } | 790 | } |
793 | /* else n == 1; nothing to do */ | 791 | /* else n == 1; nothing to do */ |
@@ -815,7 +813,7 @@ LUA_API int lua_pushupvalues (lua_State *L) { | |||
815 | n = func->c.nupvalues; | 813 | n = func->c.nupvalues; |
816 | luaD_checkstack(L, n + LUA_MINSTACK); | 814 | luaD_checkstack(L, n + LUA_MINSTACK); |
817 | for (i=0; i<n; i++) { | 815 | for (i=0; i<n; i++) { |
818 | setobj(L->top, &func->c.upvalue[i]); | 816 | setobj2s(L->top, &func->c.upvalue[i]); |
819 | L->top++; | 817 | L->top++; |
820 | } | 818 | } |
821 | lua_unlock(L); | 819 | lua_unlock(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldebug.c,v 1.134 2002/09/05 19:45:42 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.135 2002/10/16 20:40:58 roberto Exp roberto $ |
3 | ** Debug Interface | 3 | ** Debug Interface |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -127,7 +127,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { | |||
127 | if (!name || name[0] == '(') /* `(' starts private locals */ | 127 | if (!name || name[0] == '(') /* `(' starts private locals */ |
128 | name = NULL; | 128 | name = NULL; |
129 | else | 129 | else |
130 | setobj(ci->base+(n-1), L->top); | 130 | setobjs2s(ci->base+(n-1), L->top); |
131 | } | 131 | } |
132 | lua_unlock(L); | 132 | lua_unlock(L); |
133 | return name; | 133 | return name; |
@@ -218,7 +218,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { | |||
218 | break; | 218 | break; |
219 | } | 219 | } |
220 | case 'f': { | 220 | case 'f': { |
221 | setobj(L->top, f); | 221 | setobj2s(L->top, f); |
222 | status = 2; | 222 | status = 2; |
223 | break; | 223 | break; |
224 | } | 224 | } |
@@ -538,8 +538,8 @@ void luaG_errormsg (lua_State *L) { | |||
538 | if (L->errfunc != 0) { /* is there an error handling function? */ | 538 | if (L->errfunc != 0) { /* is there an error handling function? */ |
539 | StkId errfunc = restorestack(L, L->errfunc); | 539 | StkId errfunc = restorestack(L, L->errfunc); |
540 | if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); | 540 | if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); |
541 | setobj(L->top, L->top - 1); /* move argument */ | 541 | setobjs2s(L->top, L->top - 1); /* move argument */ |
542 | setobj(L->top - 1, errfunc); /* push function */ | 542 | setobjs2s(L->top - 1, errfunc); /* push function */ |
543 | incr_top(L); | 543 | incr_top(L); |
544 | luaD_call(L, L->top - 2, 1); /* call it */ | 544 | luaD_call(L, L->top - 2, 1); /* call it */ |
545 | } | 545 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 1.197 2002/10/25 20:05:28 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 1.198 2002/11/06 19:08:00 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -47,16 +47,16 @@ struct lua_longjmp { | |||
47 | static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { | 47 | static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { |
48 | switch (errcode) { | 48 | switch (errcode) { |
49 | case LUA_ERRMEM: { | 49 | case LUA_ERRMEM: { |
50 | setsvalue(oldtop, luaS_new(L, MEMERRMSG)); | 50 | setsvalue2s(oldtop, luaS_new(L, MEMERRMSG)); |
51 | break; | 51 | break; |
52 | } | 52 | } |
53 | case LUA_ERRERR: { | 53 | case LUA_ERRERR: { |
54 | setsvalue(oldtop, luaS_new(L, "error in error handling")); | 54 | setsvalue2s(oldtop, luaS_new(L, "error in error handling")); |
55 | break; | 55 | break; |
56 | } | 56 | } |
57 | case LUA_ERRSYNTAX: | 57 | case LUA_ERRSYNTAX: |
58 | case LUA_ERRRUN: { | 58 | case LUA_ERRRUN: { |
59 | setobj(oldtop, L->top - 1); /* error message on current top */ | 59 | setobjs2s(oldtop, L->top - 1); /* error message on current top */ |
60 | break; | 60 | break; |
61 | } | 61 | } |
62 | } | 62 | } |
@@ -188,7 +188,7 @@ static void adjust_varargs (lua_State *L, int nfixargs, StkId base) { | |||
188 | actual -= nfixargs; /* number of extra arguments */ | 188 | actual -= nfixargs; /* number of extra arguments */ |
189 | htab = luaH_new(L, 0, 0); /* create `arg' table */ | 189 | htab = luaH_new(L, 0, 0); /* create `arg' table */ |
190 | for (i=0; i<actual; i++) /* put extra arguments into `arg' table */ | 190 | for (i=0; i<actual; i++) /* put extra arguments into `arg' table */ |
191 | setobj(luaH_setnum(L, htab, i+1), L->top - actual + i); | 191 | setobj2t(luaH_setnum(L, htab, i+1), L->top - actual + i); |
192 | /* store counter in field `n' */ | 192 | /* store counter in field `n' */ |
193 | setsvalue(&nname, luaS_newliteral(L, "n")); | 193 | setsvalue(&nname, luaS_newliteral(L, "n")); |
194 | setnvalue(luaH_set(L, htab, &nname), actual); | 194 | setnvalue(luaH_set(L, htab, &nname), actual); |
@@ -205,10 +205,10 @@ static StkId tryfuncTM (lua_State *L, StkId func) { | |||
205 | if (!ttisfunction(tm)) | 205 | if (!ttisfunction(tm)) |
206 | luaG_typeerror(L, func, "call"); | 206 | luaG_typeerror(L, func, "call"); |
207 | /* Open a hole inside the stack at `func' */ | 207 | /* Open a hole inside the stack at `func' */ |
208 | for (p = L->top; p > func; p--) setobj(p, p-1); | 208 | for (p = L->top; p > func; p--) setobjs2s(p, p-1); |
209 | incr_top(L); | 209 | incr_top(L); |
210 | func = restorestack(L, funcr); /* previous call may change stack */ | 210 | func = restorestack(L, funcr); /* previous call may change stack */ |
211 | setobj(func, tm); /* tag method is the new function to be called */ | 211 | setobj2s(func, tm); /* tag method is the new function to be called */ |
212 | return func; | 212 | return func; |
213 | } | 213 | } |
214 | 214 | ||
@@ -270,7 +270,7 @@ void luaD_poscall (lua_State *L, int wanted, StkId firstResult) { | |||
270 | L->ci--; | 270 | L->ci--; |
271 | /* move results to correct place */ | 271 | /* move results to correct place */ |
272 | while (wanted != 0 && firstResult < L->top) { | 272 | while (wanted != 0 && firstResult < L->top) { |
273 | setobj(res++, firstResult++); | 273 | setobjs2s(res++, firstResult++); |
274 | wanted--; | 274 | wanted--; |
275 | } | 275 | } |
276 | while (wanted-- > 0) | 276 | while (wanted-- > 0) |
@@ -333,10 +333,10 @@ LUA_API int lua_resume (lua_State *L, int nargs) { | |||
333 | old_allowhooks = allowhook(L); | 333 | old_allowhooks = allowhook(L); |
334 | lua_assert(L->errfunc == 0); | 334 | lua_assert(L->errfunc == 0); |
335 | status = luaD_rawrunprotected(L, resume, &nargs); | 335 | status = luaD_rawrunprotected(L, resume, &nargs); |
336 | if (status != 0) { | 336 | if (status != 0) { /* error? */ |
337 | L->ci = L->base_ci; /* `kill' thread (??) */ | 337 | L->ci = L->base_ci; /* go back to initial level */ |
338 | luaF_close(L, L->ci->base); /* close eventual pending closures */ | ||
338 | seterrorobj(L, status, L->ci->base); | 339 | seterrorobj(L, status, L->ci->base); |
339 | luaF_close(L, L->top); /* close eventual pending closures */ | ||
340 | setallowhook(L, old_allowhooks); | 340 | setallowhook(L, old_allowhooks); |
341 | restore_stack_limit(L); | 341 | restore_stack_limit(L); |
342 | } | 342 | } |
@@ -355,7 +355,7 @@ LUA_API int lua_yield (lua_State *L, int nresults) { | |||
355 | if (L->top - nresults > ci->base) { /* is there garbage in the stack? */ | 355 | if (L->top - nresults > ci->base) { /* is there garbage in the stack? */ |
356 | int i; | 356 | int i; |
357 | for (i=0; i<nresults; i++) /* move down results */ | 357 | for (i=0; i<nresults; i++) /* move down results */ |
358 | setobj(ci->base + i, L->top - nresults + i); | 358 | setobjs2s(ci->base + i, L->top - nresults + i); |
359 | L->top = ci->base + nresults; | 359 | L->top = ci->base + nresults; |
360 | } | 360 | } |
361 | lua_unlock(L); | 361 | lua_unlock(L); |
@@ -391,8 +391,8 @@ int luaD_pcall (lua_State *L, int nargs, int nresults, ptrdiff_t errfunc) { | |||
391 | status = luaD_rawrunprotected(L, &f_call, &c); | 391 | status = luaD_rawrunprotected(L, &f_call, &c); |
392 | if (status != 0) { /* an error occurred? */ | 392 | if (status != 0) { /* an error occurred? */ |
393 | StkId oldtop = restorestack(L, old_top) - (nargs+1); | 393 | StkId oldtop = restorestack(L, old_top) - (nargs+1); |
394 | luaF_close(L, oldtop); /* close eventual pending closures */ | ||
394 | seterrorobj(L, status, oldtop); | 395 | seterrorobj(L, status, oldtop); |
395 | luaF_close(L, L->top); /* close eventual pending closures */ | ||
396 | L->ci = restoreci(L, old_ci); | 396 | L->ci = restoreci(L, old_ci); |
397 | setallowhook(L, old_allowhooks); | 397 | setallowhook(L, old_allowhooks); |
398 | restore_stack_limit(L); | 398 | restore_stack_limit(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 1.153 2002/10/22 17:58:14 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 1.154 2002/10/25 20:05:28 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -344,7 +344,7 @@ static void checkSizes (lua_State *L) { | |||
344 | static void do1gcTM (lua_State *L, Udata *udata) { | 344 | static void do1gcTM (lua_State *L, Udata *udata) { |
345 | const TObject *tm = fasttm(L, udata->uv.metatable, TM_GC); | 345 | const TObject *tm = fasttm(L, udata->uv.metatable, TM_GC); |
346 | if (tm != NULL) { | 346 | if (tm != NULL) { |
347 | setobj(L->top, tm); | 347 | setobj2s(L->top, tm); |
348 | setuvalue(L->top+1, udata); | 348 | setuvalue(L->top+1, udata); |
349 | L->top += 2; | 349 | L->top += 2; |
350 | luaD_call(L, L->top - 2, 0); | 350 | luaD_call(L, L->top - 2, 0); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.c,v 1.90 2002/10/08 18:46:08 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.91 2002/10/22 17:18:28 roberto Exp roberto $ |
3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -86,7 +86,7 @@ int luaO_str2d (const char *s, lua_Number *result) { | |||
86 | 86 | ||
87 | 87 | ||
88 | static void pushstr (lua_State *L, const char *str) { | 88 | static void pushstr (lua_State *L, const char *str) { |
89 | setsvalue(L->top, luaS_new(L, str)); | 89 | setsvalue2s(L->top, luaS_new(L, str)); |
90 | incr_top(L); | 90 | incr_top(L); |
91 | } | 91 | } |
92 | 92 | ||
@@ -98,7 +98,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { | |||
98 | for (;;) { | 98 | for (;;) { |
99 | const char *e = strchr(fmt, '%'); | 99 | const char *e = strchr(fmt, '%'); |
100 | if (e == NULL) break; | 100 | if (e == NULL) break; |
101 | setsvalue(L->top, luaS_newlstr(L, fmt, e-fmt)); | 101 | setsvalue2s(L->top, luaS_newlstr(L, fmt, e-fmt)); |
102 | incr_top(L); | 102 | incr_top(L); |
103 | switch (*(e+1)) { | 103 | switch (*(e+1)) { |
104 | case 's': | 104 | case 's': |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lobject.h,v 1.150 2002/10/25 20:05:28 roberto Exp roberto $ | 2 | ** $Id: lobject.h,v 1.151 2002/11/04 12:31:44 roberto Exp roberto $ |
3 | ** Type definitions for Lua objects | 3 | ** Type definitions for Lua objects |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -132,6 +132,7 @@ typedef struct lua_TObject { | |||
132 | #define setnilvalue(obj) ((obj)->tt=LUA_TNIL) | 132 | #define setnilvalue(obj) ((obj)->tt=LUA_TNIL) |
133 | 133 | ||
134 | 134 | ||
135 | |||
135 | /* | 136 | /* |
136 | ** for internal debug only | 137 | ** for internal debug only |
137 | */ | 138 | */ |
@@ -144,6 +145,22 @@ typedef struct lua_TObject { | |||
144 | checkconsistency(o2); \ | 145 | checkconsistency(o2); \ |
145 | o1->tt=o2->tt; o1->value = o2->value; } | 146 | o1->tt=o2->tt; o1->value = o2->value; } |
146 | 147 | ||
148 | |||
149 | /* | ||
150 | ** different types of sets, according to destination | ||
151 | */ | ||
152 | |||
153 | /* from stack to (same) stack */ | ||
154 | #define setobjs2s setobj | ||
155 | /* to stack (not from same stack) */ | ||
156 | #define setobj2s setobj | ||
157 | /* from table to same table */ | ||
158 | #define setobjt2t setobj | ||
159 | /* to table */ | ||
160 | #define setobj2t setobj | ||
161 | /* string to stack */ | ||
162 | #define setsvalue2s setsvalue | ||
163 | |||
147 | #define setttype(obj, tt) (ttype(obj) = (tt)) | 164 | #define setttype(obj, tt) (ttype(obj) = (tt)) |
148 | 165 | ||
149 | 166 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltable.c,v 1.118 2002/08/30 19:09:21 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.119 2002/09/02 19:54:49 roberto Exp roberto $ |
3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -111,7 +111,7 @@ static int arrayindex (const TObject *key) { | |||
111 | ** elements in the array part, then elements in the hash part. The | 111 | ** elements in the array part, then elements in the hash part. The |
112 | ** beginning and end of a traversal are signalled by -1. | 112 | ** beginning and end of a traversal are signalled by -1. |
113 | */ | 113 | */ |
114 | static int luaH_index (lua_State *L, Table *t, const TObject *key) { | 114 | static int luaH_index (lua_State *L, Table *t, StkId key) { |
115 | int i; | 115 | int i; |
116 | if (ttisnil(key)) return -1; /* first iteration */ | 116 | if (ttisnil(key)) return -1; /* first iteration */ |
117 | i = arrayindex(key); | 117 | i = arrayindex(key); |
@@ -129,19 +129,19 @@ static int luaH_index (lua_State *L, Table *t, const TObject *key) { | |||
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | int luaH_next (lua_State *L, Table *t, TObject *key) { | 132 | int luaH_next (lua_State *L, Table *t, StkId key) { |
133 | int i = luaH_index(L, t, key); /* find original element */ | 133 | int i = luaH_index(L, t, key); /* find original element */ |
134 | for (i++; i < t->sizearray; i++) { /* try first array part */ | 134 | for (i++; i < t->sizearray; i++) { /* try first array part */ |
135 | if (!ttisnil(&t->array[i])) { /* a non-nil value? */ | 135 | if (!ttisnil(&t->array[i])) { /* a non-nil value? */ |
136 | setnvalue(key, i+1); | 136 | setnvalue(key, i+1); |
137 | setobj(key+1, &t->array[i]); | 137 | setobj2s(key+1, &t->array[i]); |
138 | return 1; | 138 | return 1; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ | 141 | for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ |
142 | if (!ttisnil(val(node(t, i)))) { /* a non-nil value? */ | 142 | if (!ttisnil(val(node(t, i)))) { /* a non-nil value? */ |
143 | setobj(key, key(node(t, i))); | 143 | setobj2s(key, key(node(t, i))); |
144 | setobj(key+1, val(node(t, i))); | 144 | setobj2s(key+1, val(node(t, i))); |
145 | return 1; | 145 | return 1; |
146 | } | 146 | } |
147 | } | 147 | } |
@@ -270,7 +270,7 @@ static void resize (lua_State *L, Table *t, int nasize, int nhsize) { | |||
270 | /* re-insert elements from vanishing slice */ | 270 | /* re-insert elements from vanishing slice */ |
271 | for (i=nasize; i<oldasize; i++) { | 271 | for (i=nasize; i<oldasize; i++) { |
272 | if (!ttisnil(&t->array[i])) | 272 | if (!ttisnil(&t->array[i])) |
273 | setobj(luaH_setnum(L, t, i+1), &t->array[i]); | 273 | setobjt2t(luaH_setnum(L, t, i+1), &t->array[i]); |
274 | } | 274 | } |
275 | /* shrink array */ | 275 | /* shrink array */ |
276 | luaM_reallocvector(L, t->array, oldasize, nasize, TObject); | 276 | luaM_reallocvector(L, t->array, oldasize, nasize, TObject); |
@@ -279,7 +279,7 @@ static void resize (lua_State *L, Table *t, int nasize, int nhsize) { | |||
279 | for (i = twoto(oldhsize) - 1; i >= 0; i--) { | 279 | for (i = twoto(oldhsize) - 1; i >= 0; i--) { |
280 | Node *old = nold+i; | 280 | Node *old = nold+i; |
281 | if (!ttisnil(val(old))) | 281 | if (!ttisnil(val(old))) |
282 | setobj(luaH_set(L, t, key(old)), val(old)); | 282 | setobjt2t(luaH_set(L, t, key(old)), val(old)); |
283 | } | 283 | } |
284 | if (oldhsize) | 284 | if (oldhsize) |
285 | luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ | 285 | luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ |
@@ -373,7 +373,7 @@ static TObject *newkey (lua_State *L, Table *t, const TObject *key) { | |||
373 | mp = n; | 373 | mp = n; |
374 | } | 374 | } |
375 | } | 375 | } |
376 | setobj(key(mp), key); | 376 | setobj2t(key(mp), key); |
377 | lua_assert(ttisnil(val(mp))); | 377 | lua_assert(ttisnil(val(mp))); |
378 | for (;;) { /* correct `firstfree' */ | 378 | for (;;) { /* correct `firstfree' */ |
379 | if (ttisnil(key(t->firstfree))) | 379 | if (ttisnil(key(t->firstfree))) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.138 2002/10/25 20:05:28 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.139 2002/10/25 21:29:20 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -326,7 +326,7 @@ static int string_query (lua_State *L) { | |||
326 | GCObject *ts; | 326 | GCObject *ts; |
327 | int n = 0; | 327 | int n = 0; |
328 | for (ts = tb->hash[s]; ts; ts = ts->gch.next) { | 328 | for (ts = tb->hash[s]; ts; ts = ts->gch.next) { |
329 | setsvalue(L->top, &ts->ts); | 329 | setsvalue2s(L->top, &ts->ts); |
330 | incr_top(L); | 330 | incr_top(L); |
331 | n++; | 331 | n++; |
332 | } | 332 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.258 2002/10/25 20:05:28 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.259 2002/11/06 19:08:00 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 | */ |
@@ -98,9 +98,9 @@ static void traceexec (lua_State *L) { | |||
98 | 98 | ||
99 | static void callTMres (lua_State *L, const TObject *f, | 99 | static void callTMres (lua_State *L, const TObject *f, |
100 | const TObject *p1, const TObject *p2) { | 100 | const TObject *p1, const TObject *p2) { |
101 | setobj(L->top, f); /* push function */ | 101 | setobj2s(L->top, f); /* push function */ |
102 | setobj(L->top+1, p1); /* 1st argument */ | 102 | setobj2s(L->top+1, p1); /* 1st argument */ |
103 | setobj(L->top+2, p2); /* 2nd argument */ | 103 | setobj2s(L->top+2, p2); /* 2nd argument */ |
104 | luaD_checkstack(L, 3); /* cannot check before (could invalidate p1, p2) */ | 104 | luaD_checkstack(L, 3); /* cannot check before (could invalidate p1, p2) */ |
105 | L->top += 3; | 105 | L->top += 3; |
106 | luaD_call(L, L->top - 3, 1); | 106 | luaD_call(L, L->top - 3, 1); |
@@ -111,10 +111,10 @@ static void callTMres (lua_State *L, const TObject *f, | |||
111 | 111 | ||
112 | static void callTM (lua_State *L, const TObject *f, | 112 | static void callTM (lua_State *L, const TObject *f, |
113 | const TObject *p1, const TObject *p2, const TObject *p3) { | 113 | const TObject *p1, const TObject *p2, const TObject *p3) { |
114 | setobj(L->top, f); /* push function */ | 114 | setobj2s(L->top, f); /* push function */ |
115 | setobj(L->top+1, p1); /* 1st argument */ | 115 | setobj2s(L->top+1, p1); /* 1st argument */ |
116 | setobj(L->top+2, p2); /* 2nd argument */ | 116 | setobj2s(L->top+2, p2); /* 2nd argument */ |
117 | setobj(L->top+3, p3); /* 3th argument */ | 117 | setobj2s(L->top+3, p3); /* 3th argument */ |
118 | luaD_checkstack(L, 4); /* cannot check before (could invalidate p1...p3) */ | 118 | luaD_checkstack(L, 4); /* cannot check before (could invalidate p1...p3) */ |
119 | L->top += 4; | 119 | L->top += 4; |
120 | luaD_call(L, L->top - 4, 0); | 120 | luaD_call(L, L->top - 4, 0); |
@@ -176,7 +176,7 @@ void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val) { | |||
176 | TObject *oldval = luaH_set(L, h, key); /* do a primitive set */ | 176 | TObject *oldval = luaH_set(L, h, key); /* do a primitive set */ |
177 | if (!ttisnil(oldval) || /* result is no nil? */ | 177 | if (!ttisnil(oldval) || /* result is no nil? */ |
178 | (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ | 178 | (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ |
179 | setobj(oldval, val); | 179 | setobj2t(oldval, val); |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | /* else will try the tag method */ | 182 | /* else will try the tag method */ |
@@ -194,7 +194,7 @@ void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val) { | |||
194 | 194 | ||
195 | 195 | ||
196 | static int call_binTM (lua_State *L, const TObject *p1, const TObject *p2, | 196 | static int call_binTM (lua_State *L, const TObject *p1, const TObject *p2, |
197 | TObject *res, TMS event) { | 197 | StkId res, TMS event) { |
198 | ptrdiff_t result = savestack(L, res); | 198 | ptrdiff_t result = savestack(L, res); |
199 | const TObject *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ | 199 | const TObject *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ |
200 | if (ttisnil(tm)) | 200 | if (ttisnil(tm)) |
@@ -202,7 +202,7 @@ static int call_binTM (lua_State *L, const TObject *p1, const TObject *p2, | |||
202 | if (!ttisfunction(tm)) return 0; | 202 | if (!ttisfunction(tm)) return 0; |
203 | callTMres(L, tm, p1, p2); | 203 | callTMres(L, tm, p1, p2); |
204 | res = restorestack(L, result); /* previous call may change stack */ | 204 | res = restorestack(L, result); /* previous call may change stack */ |
205 | setobj(res, L->top); | 205 | setobjs2s(res, L->top); |
206 | return 1; | 206 | return 1; |
207 | } | 207 | } |
208 | 208 | ||
@@ -311,7 +311,7 @@ void luaV_concat (lua_State *L, int total, int last) { | |||
311 | memcpy(buffer+tl, svalue(top-i), l); | 311 | memcpy(buffer+tl, svalue(top-i), l); |
312 | tl += l; | 312 | tl += l; |
313 | } | 313 | } |
314 | setsvalue(top-n, luaS_newlstr(L, buffer, tl)); | 314 | setsvalue2s(top-n, luaS_newlstr(L, buffer, tl)); |
315 | } | 315 | } |
316 | total -= n-1; /* got `n' strings to create 1 new */ | 316 | total -= n-1; /* got `n' strings to create 1 new */ |
317 | last -= n-1; | 317 | last -= n-1; |
@@ -338,7 +338,7 @@ static void Arith (lua_State *L, StkId ra, | |||
338 | luaG_runerror(L, "`pow' (for `^' operator) is not a function"); | 338 | luaG_runerror(L, "`pow' (for `^' operator) is not a function"); |
339 | callTMres(L, f, b, c); | 339 | callTMres(L, f, b, c); |
340 | ra = restorestack(L, res); /* previous call may change stack */ | 340 | ra = restorestack(L, res); /* previous call may change stack */ |
341 | setobj(ra, L->top); | 341 | setobjs2s(ra, L->top); |
342 | break; | 342 | break; |
343 | } | 343 | } |
344 | default: lua_assert(0); break; | 344 | default: lua_assert(0); break; |
@@ -399,11 +399,11 @@ StkId luaV_execute (lua_State *L) { | |||
399 | GET_OPCODE(i) == OP_RETURN || GET_OPCODE(i) == OP_SETLISTO); | 399 | GET_OPCODE(i) == OP_RETURN || GET_OPCODE(i) == OP_SETLISTO); |
400 | switch (GET_OPCODE(i)) { | 400 | switch (GET_OPCODE(i)) { |
401 | case OP_MOVE: { | 401 | case OP_MOVE: { |
402 | setobj(ra, RB(i)); | 402 | setobjs2s(ra, RB(i)); |
403 | break; | 403 | break; |
404 | } | 404 | } |
405 | case OP_LOADK: { | 405 | case OP_LOADK: { |
406 | setobj(ra, KBx(i)); | 406 | setobj2s(ra, KBx(i)); |
407 | break; | 407 | break; |
408 | } | 408 | } |
409 | case OP_LOADBOOL: { | 409 | case OP_LOADBOOL: { |
@@ -420,7 +420,7 @@ StkId luaV_execute (lua_State *L) { | |||
420 | } | 420 | } |
421 | case OP_GETUPVAL: { | 421 | case OP_GETUPVAL: { |
422 | int b = GETARG_B(i); | 422 | int b = GETARG_B(i); |
423 | setobj(ra, cl->upvals[b]->v); | 423 | setobj2s(ra, cl->upvals[b]->v); |
424 | break; | 424 | break; |
425 | } | 425 | } |
426 | case OP_GETGLOBAL: { | 426 | case OP_GETGLOBAL: { |
@@ -428,9 +428,9 @@ StkId luaV_execute (lua_State *L) { | |||
428 | const TObject *v; | 428 | const TObject *v; |
429 | lua_assert(ttisstring(rb) && ttistable(&cl->g)); | 429 | lua_assert(ttisstring(rb) && ttistable(&cl->g)); |
430 | v = luaH_getstr(hvalue(&cl->g), tsvalue(rb)); | 430 | v = luaH_getstr(hvalue(&cl->g), tsvalue(rb)); |
431 | if (!ttisnil(v)) { setobj(ra, v); } | 431 | if (!ttisnil(v)) { setobj2s(ra, v); } |
432 | else | 432 | else |
433 | setobj(RA(i), luaV_index(L, &cl->g, rb, 0)); | 433 | setobj2s(RA(i), luaV_index(L, &cl->g, rb, 0)); |
434 | break; | 434 | break; |
435 | } | 435 | } |
436 | case OP_GETTABLE: { | 436 | case OP_GETTABLE: { |
@@ -438,12 +438,12 @@ StkId luaV_execute (lua_State *L) { | |||
438 | TObject *rc = RKC(i); | 438 | TObject *rc = RKC(i); |
439 | if (ttistable(rb)) { | 439 | if (ttistable(rb)) { |
440 | const TObject *v = luaH_get(hvalue(rb), rc); | 440 | const TObject *v = luaH_get(hvalue(rb), rc); |
441 | if (!ttisnil(v)) { setobj(ra, v); } | 441 | if (!ttisnil(v)) { setobj2s(ra, v); } |
442 | else | 442 | else |
443 | setobj(RA(i), luaV_index(L, rb, rc, 0)); | 443 | setobj2s(RA(i), luaV_index(L, rb, rc, 0)); |
444 | } | 444 | } |
445 | else | 445 | else |
446 | setobj(RA(i), luaV_getnotable(L, rb, rc, 0)); | 446 | setobj2s(RA(i), luaV_getnotable(L, rb, rc, 0)); |
447 | break; | 447 | break; |
448 | } | 448 | } |
449 | case OP_SETGLOBAL: { | 449 | case OP_SETGLOBAL: { |
@@ -471,15 +471,15 @@ StkId luaV_execute (lua_State *L) { | |||
471 | StkId rb = RB(i); | 471 | StkId rb = RB(i); |
472 | TObject *rc = RKC(i); | 472 | TObject *rc = RKC(i); |
473 | runtime_check(L, ttisstring(rc)); | 473 | runtime_check(L, ttisstring(rc)); |
474 | setobj(ra+1, rb); | 474 | setobjs2s(ra+1, rb); |
475 | if (ttistable(rb)) { | 475 | if (ttistable(rb)) { |
476 | const TObject *v = luaH_getstr(hvalue(rb), tsvalue(rc)); | 476 | const TObject *v = luaH_getstr(hvalue(rb), tsvalue(rc)); |
477 | if (!ttisnil(v)) { setobj(ra, v); } | 477 | if (!ttisnil(v)) { setobj2s(ra, v); } |
478 | else | 478 | else |
479 | setobj(RA(i), luaV_index(L, rb, rc, 0)); | 479 | setobj2s(RA(i), luaV_index(L, rb, rc, 0)); |
480 | } | 480 | } |
481 | else | 481 | else |
482 | setobj(RA(i), luaV_getnotable(L, rb, rc, 0)); | 482 | setobj2s(RA(i), luaV_getnotable(L, rb, rc, 0)); |
483 | break; | 483 | break; |
484 | } | 484 | } |
485 | case OP_ADD: { | 485 | case OP_ADD: { |
@@ -548,7 +548,7 @@ StkId luaV_execute (lua_State *L) { | |||
548 | int b = GETARG_B(i); | 548 | int b = GETARG_B(i); |
549 | int c = GETARG_C(i); | 549 | int c = GETARG_C(i); |
550 | luaV_concat(L, c-b+1, c); /* may change `base' (and `ra') */ | 550 | luaV_concat(L, c-b+1, c); /* may change `base' (and `ra') */ |
551 | setobj(RA(i), base+b); | 551 | setobjs2s(RA(i), base+b); |
552 | luaV_checkGC(L, base+c+1); | 552 | luaV_checkGC(L, base+c+1); |
553 | break; | 553 | break; |
554 | } | 554 | } |
@@ -575,7 +575,7 @@ StkId luaV_execute (lua_State *L) { | |||
575 | TObject *rb = RB(i); | 575 | TObject *rb = RB(i); |
576 | if (l_isfalse(rb) == GETARG_C(i)) pc++; | 576 | if (l_isfalse(rb) == GETARG_C(i)) pc++; |
577 | else { | 577 | else { |
578 | setobj(ra, rb); | 578 | setobjs2s(ra, rb); |
579 | dojump(pc, GETARG_sBx(*pc) + 1); | 579 | dojump(pc, GETARG_sBx(*pc) + 1); |
580 | } | 580 | } |
581 | break; | 581 | break; |
@@ -609,7 +609,7 @@ StkId luaV_execute (lua_State *L) { | |||
609 | StkId ra1 = RA(i); /* `luaD_precall' may change the stack */ | 609 | StkId ra1 = RA(i); /* `luaD_precall' may change the stack */ |
610 | if (L->openupval) luaF_close(L, base); | 610 | if (L->openupval) luaF_close(L, base); |
611 | for (aux = 0; ra1+aux < L->top; aux++) /* move frame down */ | 611 | for (aux = 0; ra1+aux < L->top; aux++) /* move frame down */ |
612 | setobj(base+aux-1, ra1+aux); | 612 | setobjs2s(base+aux-1, ra1+aux); |
613 | (L->ci - 1)->top = L->top = base+aux; /* correct top */ | 613 | (L->ci - 1)->top = L->top = base+aux; /* correct top */ |
614 | lua_assert(L->ci->state & CI_SAVEDPC); | 614 | lua_assert(L->ci->state & CI_SAVEDPC); |
615 | (L->ci - 1)->u.l.savedpc = L->ci->u.l.savedpc; | 615 | (L->ci - 1)->u.l.savedpc = L->ci->u.l.savedpc; |
@@ -662,9 +662,9 @@ StkId luaV_execute (lua_State *L) { | |||
662 | break; | 662 | break; |
663 | } | 663 | } |
664 | case OP_TFORLOOP: { | 664 | case OP_TFORLOOP: { |
665 | setobj(ra+4, ra+2); | 665 | setobjs2s(ra+4, ra+2); |
666 | setobj(ra+3, ra+1); | 666 | setobjs2s(ra+3, ra+1); |
667 | setobj(ra+2, ra); | 667 | setobjs2s(ra+2, ra); |
668 | L->top = ra+5; | 668 | L->top = ra+5; |
669 | luaD_call(L, ra+2, GETARG_C(i) + 1); | 669 | luaD_call(L, ra+2, GETARG_C(i) + 1); |
670 | L->top = L->ci->top; | 670 | L->top = L->ci->top; |
@@ -674,8 +674,8 @@ StkId luaV_execute (lua_State *L) { | |||
674 | } | 674 | } |
675 | case OP_TFORPREP: { /* for compatibility only */ | 675 | case OP_TFORPREP: { /* for compatibility only */ |
676 | if (ttistable(ra)) { | 676 | if (ttistable(ra)) { |
677 | setobj(ra+1, ra); | 677 | setobjs2s(ra+1, ra); |
678 | setobj(ra, luaH_getstr(hvalue(gt(L)), luaS_new(L, "next"))); | 678 | setobj2s(ra, luaH_getstr(hvalue(gt(L)), luaS_new(L, "next"))); |
679 | } | 679 | } |
680 | dojump(pc, GETARG_sBx(i)); | 680 | dojump(pc, GETARG_sBx(i)); |
681 | break; | 681 | break; |
@@ -696,7 +696,7 @@ StkId luaV_execute (lua_State *L) { | |||
696 | } | 696 | } |
697 | bc &= ~(LFIELDS_PER_FLUSH-1); /* bc = bc - bc%FPF */ | 697 | bc &= ~(LFIELDS_PER_FLUSH-1); /* bc = bc - bc%FPF */ |
698 | for (; n > 0; n--) | 698 | for (; n > 0; n--) |
699 | setobj(luaH_setnum(L, h, bc+n), ra+n); | 699 | setobj2t(luaH_setnum(L, h, bc+n), ra+n); |
700 | break; | 700 | break; |
701 | } | 701 | } |
702 | case OP_CLOSE: { | 702 | case OP_CLOSE: { |