diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-14 14:15:53 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-14 14:15:53 -0200 |
| commit | 41fd639cab8e2835ad2860442c19eb78fbc777be (patch) | |
| tree | 4ae644a4612561537169d070a90fdfd826024b26 /lapi.c | |
| parent | a845a46cc883a76cb5175c0755805ba44a37d909 (diff) | |
| download | lua-41fd639cab8e2835ad2860442c19eb78fbc777be.tar.gz lua-41fd639cab8e2835ad2860442c19eb78fbc777be.tar.bz2 lua-41fd639cab8e2835ad2860442c19eb78fbc777be.zip | |
documentation for write barriers
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 14 |
1 files changed, 7 insertions, 7 deletions
| @@ -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) { | |||
| 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); /* 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: { |
