summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-14 14:15:53 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-11-14 14:15:53 -0200
commit41fd639cab8e2835ad2860442c19eb78fbc777be (patch)
tree4ae644a4612561537169d070a90fdfd826024b26
parenta845a46cc883a76cb5175c0755805ba44a37d909 (diff)
downloadlua-41fd639cab8e2835ad2860442c19eb78fbc777be.tar.gz
lua-41fd639cab8e2835ad2860442c19eb78fbc777be.tar.bz2
lua-41fd639cab8e2835ad2860442c19eb78fbc777be.zip
documentation for write barriers
-rw-r--r--lapi.c14
-rw-r--r--lcode.c4
-rw-r--r--ldo.c4
-rw-r--r--lfunc.c4
-rw-r--r--lstate.c4
-rw-r--r--ltable.c4
-rw-r--r--lundump.c4
-rw-r--r--lvm.c12
8 files changed, 25 insertions, 25 deletions
diff --git a/lapi.c b/lapi.c
index c1880663..14fbe114 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.218 2002/11/07 15:39:23 roberto Exp roberto $ 2** $Id: lapi.c,v 1.219 2002/11/14 11:51:50 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*/
@@ -191,7 +191,7 @@ LUA_API void lua_insert (lua_State *L, int index) {
191LUA_API void lua_replace (lua_State *L, int index) { 191LUA_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); /* unknown destination */ 194 setobj(luaA_index(L, index), L->top - 1); /* write barrier */
195 L->top--; 195 L->top--;
196 lua_unlock(L); 196 lua_unlock(L);
197} 197}
@@ -438,7 +438,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
438 cl->c.f = fn; 438 cl->c.f = fn;
439 L->top -= n; 439 L->top -= n;
440 while (n--) 440 while (n--)
441 setobj(&cl->c.upvalue[n], L->top+n); 441 setobj2n(&cl->c.upvalue[n], L->top+n);
442 setclvalue(L->top, cl); 442 setclvalue(L->top, cl);
443 api_incr_top(L); 443 api_incr_top(L);
444 lua_unlock(L); 444 lua_unlock(L);
@@ -565,7 +565,7 @@ LUA_API void lua_rawset (lua_State *L, int index) {
565 api_checknelems(L, 2); 565 api_checknelems(L, 2);
566 t = luaA_index(L, index); 566 t = luaA_index(L, index);
567 api_check(L, ttistable(t)); 567 api_check(L, ttistable(t));
568 setobj2t(luaH_set(L, hvalue(t), L->top-2), L->top-1); 568 setobj2t(luaH_set(L, hvalue(t), L->top-2), L->top-1); /* write barrier */
569 L->top -= 2; 569 L->top -= 2;
570 lua_unlock(L); 570 lua_unlock(L);
571} 571}
@@ -577,7 +577,7 @@ LUA_API void lua_rawseti (lua_State *L, int index, int n) {
577 api_checknelems(L, 1); 577 api_checknelems(L, 1);
578 o = luaA_index(L, index); 578 o = luaA_index(L, index);
579 api_check(L, ttistable(o)); 579 api_check(L, ttistable(o));
580 setobj2t(luaH_setnum(L, hvalue(o), n), L->top-1); 580 setobj2t(luaH_setnum(L, hvalue(o), n), L->top-1); /* write barrier */
581 L->top--; 581 L->top--;
582 lua_unlock(L); 582 lua_unlock(L);
583} 583}
@@ -593,11 +593,11 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
593 api_check(L, ttistable(mt)); 593 api_check(L, ttistable(mt));
594 switch (ttype(obj)) { 594 switch (ttype(obj)) {
595 case LUA_TTABLE: { 595 case LUA_TTABLE: {
596 hvalue(obj)->metatable = hvalue(mt); 596 hvalue(obj)->metatable = hvalue(mt); /* write barrier */
597 break; 597 break;
598 } 598 }
599 case LUA_TUSERDATA: { 599 case LUA_TUSERDATA: {
600 uvalue(obj)->uv.metatable = hvalue(mt); 600 uvalue(obj)->uv.metatable = hvalue(mt); /* write barrier */
601 break; 601 break;
602 } 602 }
603 default: { 603 default: {
diff --git a/lcode.c b/lcode.c
index e3420ac1..491adb10 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.111 2002/08/21 18:56:33 roberto Exp roberto $ 2** $Id: lcode.c,v 1.112 2002/10/16 20:40:58 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -214,7 +214,7 @@ static int addk (FuncState *fs, TObject *k, TObject *v) {
214 Proto *f = fs->f; 214 Proto *f = fs->f;
215 luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject, 215 luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject,
216 MAXARG_Bx, "constant table overflow"); 216 MAXARG_Bx, "constant table overflow");
217 setobj(&f->k[fs->nk], v); 217 setobj2n(&f->k[fs->nk], v);
218 setnvalue(luaH_set(fs->L, fs->h, k), fs->nk); 218 setnvalue(luaH_set(fs->L, fs->h, k), fs->nk);
219 return fs->nk++; 219 return fs->nk++;
220 } 220 }
diff --git a/ldo.c b/ldo.c
index a3e084b0..ae752ece 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.199 2002/11/07 15:37:10 roberto Exp roberto $ 2** $Id: ldo.c,v 1.200 2002/11/13 11:31:39 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*/
@@ -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 setobj2t(luaH_setnum(L, htab, i+1), L->top - actual + i); 191 setobj2n(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);
diff --git a/lfunc.c b/lfunc.c
index a34f31aa..feb5f29a 100644
--- a/lfunc.c
+++ b/lfunc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lfunc.c,v 1.61 2002/10/21 20:41:46 roberto Exp roberto $ 2** $Id: lfunc.c,v 1.62 2002/11/13 11:31:39 roberto Exp roberto $
3** Auxiliary functions to manipulate prototypes and closures 3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -64,7 +64,7 @@ UpVal *luaF_findupval (lua_State *L, StkId level) {
64void luaF_close (lua_State *L, StkId level) { 64void luaF_close (lua_State *L, StkId level) {
65 UpVal *p; 65 UpVal *p;
66 while ((p = ngcotouv(L->openupval)) != NULL && p->v >= level) { 66 while ((p = ngcotouv(L->openupval)) != NULL && p->v >= level) {
67 setobj(&p->value, p->v); /* save current value */ 67 setobj(&p->value, p->v); /* save current value (write barrier) */
68 p->v = &p->value; /* now current value lives here */ 68 p->v = &p->value; /* now current value lives here */
69 L->openupval = p->next; /* remove from `open' list */ 69 L->openupval = p->next; /* remove from `open' list */
70 luaC_link(L, valtogco(p), LUA_TUPVAL); 70 luaC_link(L, valtogco(p), LUA_TUPVAL);
diff --git a/lstate.c b/lstate.c
index 0213a0b4..2d19405d 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 1.109 2002/10/25 21:30:00 roberto Exp roberto $ 2** $Id: lstate.c,v 1.110 2002/11/13 11:31:39 roberto Exp roberto $
3** Global State 3** Global State
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -129,7 +129,7 @@ lua_State *luaE_newthread (lua_State *L) {
129 preinit_state(L1); 129 preinit_state(L1);
130 L1->l_G = L->l_G; 130 L1->l_G = L->l_G;
131 stack_init(L1, L); /* init stack */ 131 stack_init(L1, L); /* init stack */
132 setobj(gt(L1), gt(L)); /* share table of globals */ 132 setobj2n(gt(L1), gt(L)); /* share table of globals */
133 return L1; 133 return L1;
134} 134}
135 135
diff --git a/ltable.c b/ltable.c
index 04b3db35..1250877a 100644
--- a/ltable.c
+++ b/ltable.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltable.c,v 1.121 2002/11/13 11:31:39 roberto Exp roberto $ 2** $Id: ltable.c,v 1.122 2002/11/14 11:51:50 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*/
@@ -372,7 +372,7 @@ static TObject *newkey (lua_State *L, Table *t, const TObject *key) {
372 mp = n; 372 mp = n;
373 } 373 }
374 } 374 }
375 setobj2t(key(mp), key); 375 setobj2t(key(mp), key); /* write barrier */
376 lua_assert(ttisnil(val(mp))); 376 lua_assert(ttisnil(val(mp)));
377 for (;;) { /* correct `firstfree' */ 377 for (;;) { /* correct `firstfree' */
378 if (ttisnil(key(t->firstfree))) 378 if (ttisnil(key(t->firstfree)))
diff --git a/lundump.c b/lundump.c
index d91d4508..a0d0e19f 100644
--- a/lundump.c
+++ b/lundump.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lundump.c,v 1.43 2002/08/07 00:36:03 lhf Exp lhf $ 2** $Id: lundump.c,v 1.56 2002/10/25 21:30:41 roberto Exp roberto $
3** load pre-compiled Lua chunks 3** load pre-compiled Lua chunks
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -154,7 +154,7 @@ static void LoadConstants (LoadState* S, Proto* f)
154 setnvalue(o,LoadNumber(S)); 154 setnvalue(o,LoadNumber(S));
155 break; 155 break;
156 case LUA_TSTRING: 156 case LUA_TSTRING:
157 setsvalue(o,LoadString(S)); 157 setsvalue2n(o,LoadString(S));
158 break; 158 break;
159 case LUA_TNIL: 159 case LUA_TNIL:
160 setnilvalue(o); 160 setnilvalue(o);
diff --git a/lvm.c b/lvm.c
index 93c95e43..03ef02fe 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.259 2002/11/06 19:08:00 roberto Exp roberto $ 2** $Id: lvm.c,v 1.260 2002/11/07 15:37:10 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*/
@@ -57,13 +57,13 @@ const TObject *luaV_tonumber (const TObject *obj, TObject *n) {
57} 57}
58 58
59 59
60int luaV_tostring (lua_State *L, TObject *obj) { 60int luaV_tostring (lua_State *L, StkId obj) {
61 if (!ttisnumber(obj)) 61 if (!ttisnumber(obj))
62 return 0; 62 return 0;
63 else { 63 else {
64 char s[32]; /* 16 digits, sign, point and \0 (+ some extra...) */ 64 char s[32]; /* 16 digits, sign, point and \0 (+ some extra...) */
65 lua_number2str(s, nvalue(obj)); 65 lua_number2str(s, nvalue(obj));
66 setsvalue(obj, luaS_new(L, s)); 66 setsvalue2s(obj, luaS_new(L, s));
67 return 1; 67 return 1;
68 } 68 }
69} 69}
@@ -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 setobj2t(oldval, val); 179 setobj2t(oldval, val); /* write barrier */
180 return; 180 return;
181 } 181 }
182 /* else will try the tag method */ 182 /* else will try the tag method */
@@ -453,7 +453,7 @@ StkId luaV_execute (lua_State *L) {
453 } 453 }
454 case OP_SETUPVAL: { 454 case OP_SETUPVAL: {
455 int b = GETARG_B(i); 455 int b = GETARG_B(i);
456 setobj(cl->upvals[b]->v, ra); 456 setobj(cl->upvals[b]->v, ra); /* write barrier */
457 break; 457 break;
458 } 458 }
459 case OP_SETTABLE: { 459 case OP_SETTABLE: {
@@ -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 setobj2t(luaH_setnum(L, h, bc+n), ra+n); 699 setobj2t(luaH_setnum(L, h, bc+n), ra+n); /* write barrier */
700 break; 700 break;
701 } 701 }
702 case OP_CLOSE: { 702 case OP_CLOSE: {