commit dff9be4224a1cd0f338b544b9e01d42f0f4e537f
parent 118347d8c3b83ea0291918e81c5367937316fabb
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 7 Nov 2002 13:36:48 -0200
new macros to distinguish different types of object moves (for future GC
evolution).
Diffstat:
9 files changed, 103 insertions(+), 88 deletions(-)
diff --git a/lapi.c b/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 1.215 2002/10/25 21:31:28 roberto Exp roberto $
+** $Id: lapi.c,v 1.216 2002/11/06 19:08:00 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -84,7 +84,7 @@ static TObject *luaA_indexAcceptable (lua_State *L, int index) {
void luaA_pushobject (lua_State *L, const TObject *o) {
- setobj(L->top, o);
+ setobj2s(L->top, o);
incr_top(L);
}
@@ -111,7 +111,7 @@ LUA_API void lua_movethread (lua_State *from, lua_State *to, int n) {
api_checknelems(from, n);
from->top -= n;
for (i = 0; i < n; i++) {
- setobj(to->top, from->top + i);
+ setobj2s(to->top, from->top + i);
api_incr_top(to);
}
lua_unlock(to);
@@ -171,7 +171,7 @@ LUA_API void lua_remove (lua_State *L, int index) {
StkId p;
lua_lock(L);
p = luaA_index(L, index);
- while (++p < L->top) setobj(p-1, p);
+ while (++p < L->top) setobjs2s(p-1, p);
L->top--;
lua_unlock(L);
}
@@ -182,8 +182,8 @@ LUA_API void lua_insert (lua_State *L, int index) {
StkId q;
lua_lock(L);
p = luaA_index(L, index);
- for (q = L->top; q>p; q--) setobj(q, q-1);
- setobj(p, L->top);
+ for (q = L->top; q>p; q--) setobjs2s(q, q-1);
+ setobjs2s(p, L->top);
lua_unlock(L);
}
@@ -191,7 +191,7 @@ LUA_API void lua_insert (lua_State *L, int index) {
LUA_API void lua_replace (lua_State *L, int index) {
lua_lock(L);
api_checknelems(L, 1);
- setobj(luaA_index(L, index), L->top - 1);
+ setobj(luaA_index(L, index), L->top - 1); /* unknown destination */
L->top--;
lua_unlock(L);
}
@@ -199,7 +199,7 @@ LUA_API void lua_replace (lua_State *L, int index) {
LUA_API void lua_pushvalue (lua_State *L, int index) {
lua_lock(L);
- setobj(L->top, luaA_index(L, index));
+ setobj2s(L->top, luaA_index(L, index));
api_incr_top(L);
lua_unlock(L);
}
@@ -394,7 +394,7 @@ LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
lua_lock(L);
- setsvalue(L->top, luaS_newlstr(L, s, len));
+ setsvalue2s(L->top, luaS_newlstr(L, s, len));
api_incr_top(L);
lua_unlock(L);
}
@@ -469,11 +469,9 @@ LUA_API void lua_pushlightuserdata (lua_State *L, void *p) {
LUA_API void lua_gettable (lua_State *L, int index) {
StkId t;
- const TObject *v;
lua_lock(L);
t = luaA_index(L, index);
- v = luaV_gettable(L, t, L->top-1, 0);
- setobj(L->top - 1, v);
+ setobj2s(L->top - 1, luaV_gettable(L, t, L->top - 1, 0));
lua_unlock(L);
}
@@ -483,7 +481,7 @@ LUA_API void lua_rawget (lua_State *L, int index) {
lua_lock(L);
t = luaA_index(L, index);
api_check(L, ttistable(t));
- setobj(L->top - 1, luaH_get(hvalue(t), L->top - 1));
+ setobj2s(L->top - 1, luaH_get(hvalue(t), L->top - 1));
lua_unlock(L);
}
@@ -493,7 +491,7 @@ LUA_API void lua_rawgeti (lua_State *L, int index, int n) {
lua_lock(L);
o = luaA_index(L, index);
api_check(L, ttistable(o));
- setobj(L->top, luaH_getnum(hvalue(o), n));
+ setobj2s(L->top, luaH_getnum(hvalue(o), n));
api_incr_top(L);
lua_unlock(L);
}
@@ -553,7 +551,7 @@ LUA_API void lua_getglobals (lua_State *L, int index) {
StkId o;
lua_lock(L);
o = luaA_index(L, index);
- setobj(L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L));
+ setobj2s(L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L));
api_incr_top(L);
lua_unlock(L);
}
@@ -581,7 +579,7 @@ LUA_API void lua_rawset (lua_State *L, int index) {
api_checknelems(L, 2);
t = luaA_index(L, index);
api_check(L, ttistable(t));
- setobj(luaH_set(L, hvalue(t), L->top-2), L->top-1);
+ setobj2t(luaH_set(L, hvalue(t), L->top-2), L->top-1);
L->top -= 2;
lua_unlock(L);
}
@@ -593,7 +591,7 @@ LUA_API void lua_rawseti (lua_State *L, int index, int n) {
api_checknelems(L, 1);
o = luaA_index(L, index);
api_check(L, ttistable(o));
- setobj(luaH_setnum(L, hvalue(o), n), L->top-1);
+ setobj2t(luaH_setnum(L, hvalue(o), n), L->top-1);
L->top--;
lua_unlock(L);
}
@@ -787,7 +785,7 @@ LUA_API void lua_concat (lua_State *L, int n) {
luaC_checkGC(L);
}
else if (n == 0) { /* push empty string */
- setsvalue(L->top, luaS_newlstr(L, NULL, 0));
+ setsvalue2s(L->top, luaS_newlstr(L, NULL, 0));
api_incr_top(L);
}
/* else n == 1; nothing to do */
@@ -815,7 +813,7 @@ LUA_API int lua_pushupvalues (lua_State *L) {
n = func->c.nupvalues;
luaD_checkstack(L, n + LUA_MINSTACK);
for (i=0; i<n; i++) {
- setobj(L->top, &func->c.upvalue[i]);
+ setobj2s(L->top, &func->c.upvalue[i]);
L->top++;
}
lua_unlock(L);
diff --git a/ldebug.c b/ldebug.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldebug.c,v 1.134 2002/09/05 19:45:42 roberto Exp roberto $
+** $Id: ldebug.c,v 1.135 2002/10/16 20:40:58 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@@ -127,7 +127,7 @@ LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
if (!name || name[0] == '(') /* `(' starts private locals */
name = NULL;
else
- setobj(ci->base+(n-1), L->top);
+ setobjs2s(ci->base+(n-1), L->top);
}
lua_unlock(L);
return name;
@@ -218,7 +218,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
break;
}
case 'f': {
- setobj(L->top, f);
+ setobj2s(L->top, f);
status = 2;
break;
}
@@ -538,8 +538,8 @@ void luaG_errormsg (lua_State *L) {
if (L->errfunc != 0) { /* is there an error handling function? */
StkId errfunc = restorestack(L, L->errfunc);
if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR);
- setobj(L->top, L->top - 1); /* move argument */
- setobj(L->top - 1, errfunc); /* push function */
+ setobjs2s(L->top, L->top - 1); /* move argument */
+ setobjs2s(L->top - 1, errfunc); /* push function */
incr_top(L);
luaD_call(L, L->top - 2, 1); /* call it */
}
diff --git a/ldo.c b/ldo.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.c,v 1.197 2002/10/25 20:05:28 roberto Exp roberto $
+** $Id: ldo.c,v 1.198 2002/11/06 19:08:00 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -47,16 +47,16 @@ struct lua_longjmp {
static void seterrorobj (lua_State *L, int errcode, StkId oldtop) {
switch (errcode) {
case LUA_ERRMEM: {
- setsvalue(oldtop, luaS_new(L, MEMERRMSG));
+ setsvalue2s(oldtop, luaS_new(L, MEMERRMSG));
break;
}
case LUA_ERRERR: {
- setsvalue(oldtop, luaS_new(L, "error in error handling"));
+ setsvalue2s(oldtop, luaS_new(L, "error in error handling"));
break;
}
case LUA_ERRSYNTAX:
case LUA_ERRRUN: {
- setobj(oldtop, L->top - 1); /* error message on current top */
+ setobjs2s(oldtop, L->top - 1); /* error message on current top */
break;
}
}
@@ -188,7 +188,7 @@ static void adjust_varargs (lua_State *L, int nfixargs, StkId base) {
actual -= nfixargs; /* number of extra arguments */
htab = luaH_new(L, 0, 0); /* create `arg' table */
for (i=0; i<actual; i++) /* put extra arguments into `arg' table */
- setobj(luaH_setnum(L, htab, i+1), L->top - actual + i);
+ setobj2t(luaH_setnum(L, htab, i+1), L->top - actual + i);
/* store counter in field `n' */
setsvalue(&nname, luaS_newliteral(L, "n"));
setnvalue(luaH_set(L, htab, &nname), actual);
@@ -205,10 +205,10 @@ static StkId tryfuncTM (lua_State *L, StkId func) {
if (!ttisfunction(tm))
luaG_typeerror(L, func, "call");
/* Open a hole inside the stack at `func' */
- for (p = L->top; p > func; p--) setobj(p, p-1);
+ for (p = L->top; p > func; p--) setobjs2s(p, p-1);
incr_top(L);
func = restorestack(L, funcr); /* previous call may change stack */
- setobj(func, tm); /* tag method is the new function to be called */
+ setobj2s(func, tm); /* tag method is the new function to be called */
return func;
}
@@ -270,7 +270,7 @@ void luaD_poscall (lua_State *L, int wanted, StkId firstResult) {
L->ci--;
/* move results to correct place */
while (wanted != 0 && firstResult < L->top) {
- setobj(res++, firstResult++);
+ setobjs2s(res++, firstResult++);
wanted--;
}
while (wanted-- > 0)
@@ -333,10 +333,10 @@ LUA_API int lua_resume (lua_State *L, int nargs) {
old_allowhooks = allowhook(L);
lua_assert(L->errfunc == 0);
status = luaD_rawrunprotected(L, resume, &nargs);
- if (status != 0) {
- L->ci = L->base_ci; /* `kill' thread (??) */
+ if (status != 0) { /* error? */
+ L->ci = L->base_ci; /* go back to initial level */
+ luaF_close(L, L->ci->base); /* close eventual pending closures */
seterrorobj(L, status, L->ci->base);
- luaF_close(L, L->top); /* close eventual pending closures */
setallowhook(L, old_allowhooks);
restore_stack_limit(L);
}
@@ -355,7 +355,7 @@ LUA_API int lua_yield (lua_State *L, int nresults) {
if (L->top - nresults > ci->base) { /* is there garbage in the stack? */
int i;
for (i=0; i<nresults; i++) /* move down results */
- setobj(ci->base + i, L->top - nresults + i);
+ setobjs2s(ci->base + i, L->top - nresults + i);
L->top = ci->base + nresults;
}
lua_unlock(L);
@@ -391,8 +391,8 @@ int luaD_pcall (lua_State *L, int nargs, int nresults, ptrdiff_t errfunc) {
status = luaD_rawrunprotected(L, &f_call, &c);
if (status != 0) { /* an error occurred? */
StkId oldtop = restorestack(L, old_top) - (nargs+1);
+ luaF_close(L, oldtop); /* close eventual pending closures */
seterrorobj(L, status, oldtop);
- luaF_close(L, L->top); /* close eventual pending closures */
L->ci = restoreci(L, old_ci);
setallowhook(L, old_allowhooks);
restore_stack_limit(L);
diff --git a/lgc.c b/lgc.c
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.c,v 1.153 2002/10/22 17:58:14 roberto Exp roberto $
+** $Id: lgc.c,v 1.154 2002/10/25 20:05:28 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -344,7 +344,7 @@ static void checkSizes (lua_State *L) {
static void do1gcTM (lua_State *L, Udata *udata) {
const TObject *tm = fasttm(L, udata->uv.metatable, TM_GC);
if (tm != NULL) {
- setobj(L->top, tm);
+ setobj2s(L->top, tm);
setuvalue(L->top+1, udata);
L->top += 2;
luaD_call(L, L->top - 2, 0);
diff --git a/lobject.c b/lobject.c
@@ -1,5 +1,5 @@
/*
-** $Id: lobject.c,v 1.90 2002/10/08 18:46:08 roberto Exp roberto $
+** $Id: lobject.c,v 1.91 2002/10/22 17:18:28 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@@ -86,7 +86,7 @@ int luaO_str2d (const char *s, lua_Number *result) {
static void pushstr (lua_State *L, const char *str) {
- setsvalue(L->top, luaS_new(L, str));
+ setsvalue2s(L->top, luaS_new(L, str));
incr_top(L);
}
@@ -98,7 +98,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
for (;;) {
const char *e = strchr(fmt, '%');
if (e == NULL) break;
- setsvalue(L->top, luaS_newlstr(L, fmt, e-fmt));
+ setsvalue2s(L->top, luaS_newlstr(L, fmt, e-fmt));
incr_top(L);
switch (*(e+1)) {
case 's':
diff --git a/lobject.h b/lobject.h
@@ -1,5 +1,5 @@
/*
-** $Id: lobject.h,v 1.150 2002/10/25 20:05:28 roberto Exp roberto $
+** $Id: lobject.h,v 1.151 2002/11/04 12:31:44 roberto Exp roberto $
** Type definitions for Lua objects
** See Copyright Notice in lua.h
*/
@@ -132,6 +132,7 @@ typedef struct lua_TObject {
#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
+
/*
** for internal debug only
*/
@@ -144,6 +145,22 @@ typedef struct lua_TObject {
checkconsistency(o2); \
o1->tt=o2->tt; o1->value = o2->value; }
+
+/*
+** different types of sets, according to destination
+*/
+
+/* from stack to (same) stack */
+#define setobjs2s setobj
+/* to stack (not from same stack) */
+#define setobj2s setobj
+/* from table to same table */
+#define setobjt2t setobj
+/* to table */
+#define setobj2t setobj
+/* string to stack */
+#define setsvalue2s setsvalue
+
#define setttype(obj, tt) (ttype(obj) = (tt))
diff --git a/ltable.c b/ltable.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltable.c,v 1.118 2002/08/30 19:09:21 roberto Exp roberto $
+** $Id: ltable.c,v 1.119 2002/09/02 19:54:49 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -111,7 +111,7 @@ static int arrayindex (const TObject *key) {
** elements in the array part, then elements in the hash part. The
** beginning and end of a traversal are signalled by -1.
*/
-static int luaH_index (lua_State *L, Table *t, const TObject *key) {
+static int luaH_index (lua_State *L, Table *t, StkId key) {
int i;
if (ttisnil(key)) return -1; /* first iteration */
i = arrayindex(key);
@@ -129,19 +129,19 @@ static int luaH_index (lua_State *L, Table *t, const TObject *key) {
}
-int luaH_next (lua_State *L, Table *t, TObject *key) {
+int luaH_next (lua_State *L, Table *t, StkId key) {
int i = luaH_index(L, t, key); /* find original element */
for (i++; i < t->sizearray; i++) { /* try first array part */
if (!ttisnil(&t->array[i])) { /* a non-nil value? */
setnvalue(key, i+1);
- setobj(key+1, &t->array[i]);
+ setobj2s(key+1, &t->array[i]);
return 1;
}
}
for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */
if (!ttisnil(val(node(t, i)))) { /* a non-nil value? */
- setobj(key, key(node(t, i)));
- setobj(key+1, val(node(t, i)));
+ setobj2s(key, key(node(t, i)));
+ setobj2s(key+1, val(node(t, i)));
return 1;
}
}
@@ -270,7 +270,7 @@ static void resize (lua_State *L, Table *t, int nasize, int nhsize) {
/* re-insert elements from vanishing slice */
for (i=nasize; i<oldasize; i++) {
if (!ttisnil(&t->array[i]))
- setobj(luaH_setnum(L, t, i+1), &t->array[i]);
+ setobjt2t(luaH_setnum(L, t, i+1), &t->array[i]);
}
/* shrink array */
luaM_reallocvector(L, t->array, oldasize, nasize, TObject);
@@ -279,7 +279,7 @@ static void resize (lua_State *L, Table *t, int nasize, int nhsize) {
for (i = twoto(oldhsize) - 1; i >= 0; i--) {
Node *old = nold+i;
if (!ttisnil(val(old)))
- setobj(luaH_set(L, t, key(old)), val(old));
+ setobjt2t(luaH_set(L, t, key(old)), val(old));
}
if (oldhsize)
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) {
mp = n;
}
}
- setobj(key(mp), key);
+ setobj2t(key(mp), key);
lua_assert(ttisnil(val(mp)));
for (;;) { /* correct `firstfree' */
if (ttisnil(key(t->firstfree)))
diff --git a/ltests.c b/ltests.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltests.c,v 1.138 2002/10/25 20:05:28 roberto Exp roberto $
+** $Id: ltests.c,v 1.139 2002/10/25 21:29:20 roberto Exp roberto $
** Internal Module for Debugging of the Lua Implementation
** See Copyright Notice in lua.h
*/
@@ -326,7 +326,7 @@ static int string_query (lua_State *L) {
GCObject *ts;
int n = 0;
for (ts = tb->hash[s]; ts; ts = ts->gch.next) {
- setsvalue(L->top, &ts->ts);
+ setsvalue2s(L->top, &ts->ts);
incr_top(L);
n++;
}
diff --git a/lvm.c b/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 1.258 2002/10/25 20:05:28 roberto Exp roberto $
+** $Id: lvm.c,v 1.259 2002/11/06 19:08:00 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -98,9 +98,9 @@ static void traceexec (lua_State *L) {
static void callTMres (lua_State *L, const TObject *f,
const TObject *p1, const TObject *p2) {
- setobj(L->top, f); /* push function */
- setobj(L->top+1, p1); /* 1st argument */
- setobj(L->top+2, p2); /* 2nd argument */
+ setobj2s(L->top, f); /* push function */
+ setobj2s(L->top+1, p1); /* 1st argument */
+ setobj2s(L->top+2, p2); /* 2nd argument */
luaD_checkstack(L, 3); /* cannot check before (could invalidate p1, p2) */
L->top += 3;
luaD_call(L, L->top - 3, 1);
@@ -111,10 +111,10 @@ static void callTMres (lua_State *L, const TObject *f,
static void callTM (lua_State *L, const TObject *f,
const TObject *p1, const TObject *p2, const TObject *p3) {
- setobj(L->top, f); /* push function */
- setobj(L->top+1, p1); /* 1st argument */
- setobj(L->top+2, p2); /* 2nd argument */
- setobj(L->top+3, p3); /* 3th argument */
+ setobj2s(L->top, f); /* push function */
+ setobj2s(L->top+1, p1); /* 1st argument */
+ setobj2s(L->top+2, p2); /* 2nd argument */
+ setobj2s(L->top+3, p3); /* 3th argument */
luaD_checkstack(L, 4); /* cannot check before (could invalidate p1...p3) */
L->top += 4;
luaD_call(L, L->top - 4, 0);
@@ -176,7 +176,7 @@ void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val) {
TObject *oldval = luaH_set(L, h, key); /* do a primitive set */
if (!ttisnil(oldval) || /* result is no nil? */
(tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */
- setobj(oldval, val);
+ setobj2t(oldval, val);
return;
}
/* else will try the tag method */
@@ -194,7 +194,7 @@ void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val) {
static int call_binTM (lua_State *L, const TObject *p1, const TObject *p2,
- TObject *res, TMS event) {
+ StkId res, TMS event) {
ptrdiff_t result = savestack(L, res);
const TObject *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */
if (ttisnil(tm))
@@ -202,7 +202,7 @@ static int call_binTM (lua_State *L, const TObject *p1, const TObject *p2,
if (!ttisfunction(tm)) return 0;
callTMres(L, tm, p1, p2);
res = restorestack(L, result); /* previous call may change stack */
- setobj(res, L->top);
+ setobjs2s(res, L->top);
return 1;
}
@@ -311,7 +311,7 @@ void luaV_concat (lua_State *L, int total, int last) {
memcpy(buffer+tl, svalue(top-i), l);
tl += l;
}
- setsvalue(top-n, luaS_newlstr(L, buffer, tl));
+ setsvalue2s(top-n, luaS_newlstr(L, buffer, tl));
}
total -= n-1; /* got `n' strings to create 1 new */
last -= n-1;
@@ -338,7 +338,7 @@ static void Arith (lua_State *L, StkId ra,
luaG_runerror(L, "`pow' (for `^' operator) is not a function");
callTMres(L, f, b, c);
ra = restorestack(L, res); /* previous call may change stack */
- setobj(ra, L->top);
+ setobjs2s(ra, L->top);
break;
}
default: lua_assert(0); break;
@@ -399,11 +399,11 @@ StkId luaV_execute (lua_State *L) {
GET_OPCODE(i) == OP_RETURN || GET_OPCODE(i) == OP_SETLISTO);
switch (GET_OPCODE(i)) {
case OP_MOVE: {
- setobj(ra, RB(i));
+ setobjs2s(ra, RB(i));
break;
}
case OP_LOADK: {
- setobj(ra, KBx(i));
+ setobj2s(ra, KBx(i));
break;
}
case OP_LOADBOOL: {
@@ -420,7 +420,7 @@ StkId luaV_execute (lua_State *L) {
}
case OP_GETUPVAL: {
int b = GETARG_B(i);
- setobj(ra, cl->upvals[b]->v);
+ setobj2s(ra, cl->upvals[b]->v);
break;
}
case OP_GETGLOBAL: {
@@ -428,9 +428,9 @@ StkId luaV_execute (lua_State *L) {
const TObject *v;
lua_assert(ttisstring(rb) && ttistable(&cl->g));
v = luaH_getstr(hvalue(&cl->g), tsvalue(rb));
- if (!ttisnil(v)) { setobj(ra, v); }
+ if (!ttisnil(v)) { setobj2s(ra, v); }
else
- setobj(RA(i), luaV_index(L, &cl->g, rb, 0));
+ setobj2s(RA(i), luaV_index(L, &cl->g, rb, 0));
break;
}
case OP_GETTABLE: {
@@ -438,12 +438,12 @@ StkId luaV_execute (lua_State *L) {
TObject *rc = RKC(i);
if (ttistable(rb)) {
const TObject *v = luaH_get(hvalue(rb), rc);
- if (!ttisnil(v)) { setobj(ra, v); }
+ if (!ttisnil(v)) { setobj2s(ra, v); }
else
- setobj(RA(i), luaV_index(L, rb, rc, 0));
+ setobj2s(RA(i), luaV_index(L, rb, rc, 0));
}
else
- setobj(RA(i), luaV_getnotable(L, rb, rc, 0));
+ setobj2s(RA(i), luaV_getnotable(L, rb, rc, 0));
break;
}
case OP_SETGLOBAL: {
@@ -471,15 +471,15 @@ StkId luaV_execute (lua_State *L) {
StkId rb = RB(i);
TObject *rc = RKC(i);
runtime_check(L, ttisstring(rc));
- setobj(ra+1, rb);
+ setobjs2s(ra+1, rb);
if (ttistable(rb)) {
const TObject *v = luaH_getstr(hvalue(rb), tsvalue(rc));
- if (!ttisnil(v)) { setobj(ra, v); }
+ if (!ttisnil(v)) { setobj2s(ra, v); }
else
- setobj(RA(i), luaV_index(L, rb, rc, 0));
+ setobj2s(RA(i), luaV_index(L, rb, rc, 0));
}
else
- setobj(RA(i), luaV_getnotable(L, rb, rc, 0));
+ setobj2s(RA(i), luaV_getnotable(L, rb, rc, 0));
break;
}
case OP_ADD: {
@@ -548,7 +548,7 @@ StkId luaV_execute (lua_State *L) {
int b = GETARG_B(i);
int c = GETARG_C(i);
luaV_concat(L, c-b+1, c); /* may change `base' (and `ra') */
- setobj(RA(i), base+b);
+ setobjs2s(RA(i), base+b);
luaV_checkGC(L, base+c+1);
break;
}
@@ -575,7 +575,7 @@ StkId luaV_execute (lua_State *L) {
TObject *rb = RB(i);
if (l_isfalse(rb) == GETARG_C(i)) pc++;
else {
- setobj(ra, rb);
+ setobjs2s(ra, rb);
dojump(pc, GETARG_sBx(*pc) + 1);
}
break;
@@ -609,7 +609,7 @@ StkId luaV_execute (lua_State *L) {
StkId ra1 = RA(i); /* `luaD_precall' may change the stack */
if (L->openupval) luaF_close(L, base);
for (aux = 0; ra1+aux < L->top; aux++) /* move frame down */
- setobj(base+aux-1, ra1+aux);
+ setobjs2s(base+aux-1, ra1+aux);
(L->ci - 1)->top = L->top = base+aux; /* correct top */
lua_assert(L->ci->state & CI_SAVEDPC);
(L->ci - 1)->u.l.savedpc = L->ci->u.l.savedpc;
@@ -662,9 +662,9 @@ StkId luaV_execute (lua_State *L) {
break;
}
case OP_TFORLOOP: {
- setobj(ra+4, ra+2);
- setobj(ra+3, ra+1);
- setobj(ra+2, ra);
+ setobjs2s(ra+4, ra+2);
+ setobjs2s(ra+3, ra+1);
+ setobjs2s(ra+2, ra);
L->top = ra+5;
luaD_call(L, ra+2, GETARG_C(i) + 1);
L->top = L->ci->top;
@@ -674,8 +674,8 @@ StkId luaV_execute (lua_State *L) {
}
case OP_TFORPREP: { /* for compatibility only */
if (ttistable(ra)) {
- setobj(ra+1, ra);
- setobj(ra, luaH_getstr(hvalue(gt(L)), luaS_new(L, "next")));
+ setobjs2s(ra+1, ra);
+ setobj2s(ra, luaH_getstr(hvalue(gt(L)), luaS_new(L, "next")));
}
dojump(pc, GETARG_sBx(i));
break;
@@ -696,7 +696,7 @@ StkId luaV_execute (lua_State *L) {
}
bc &= ~(LFIELDS_PER_FLUSH-1); /* bc = bc - bc%FPF */
for (; n > 0; n--)
- setobj(luaH_setnum(L, h, bc+n), ra+n);
+ setobj2t(luaH_setnum(L, h, bc+n), ra+n);
break;
}
case OP_CLOSE: {