summaryrefslogtreecommitdiff
path: root/src/lj_api.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-04-21 01:45:58 +0200
committerMike Pall <mike>2010-04-21 01:45:58 +0200
commitab45481199e9c9dd3efec922647bcec122504bcb (patch)
tree0484341edff50a0afe98133ad66fb6a59915996a /src/lj_api.c
parentd8cb69ed076c3444258f63314662451c9d117cae (diff)
downloadluajit-ab45481199e9c9dd3efec922647bcec122504bcb.tar.gz
luajit-ab45481199e9c9dd3efec922647bcec122504bcb.tar.bz2
luajit-ab45481199e9c9dd3efec922647bcec122504bcb.zip
No longer let the GC replace dead keys with the LJ_TDEADKEY tag.
Important: this changes the semantics of the write barrier! Carefully read the big comment block in lj_obj.h This helps HREFK key slot specialization and allows safely hoisting HREF/HREFK across GC steps, too (fix for a barely reproducible bug). Dead keys are only removed during a table resize (as before).
Diffstat (limited to 'src/lj_api.c')
-rw-r--r--src/lj_api.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lj_api.c b/src/lj_api.c
index a19f0b33..aac3b4c9 100644
--- a/src/lj_api.c
+++ b/src/lj_api.c
@@ -196,7 +196,8 @@ LUA_API int lua_type(lua_State *L, int idx)
196 return LUA_TNONE; 196 return LUA_TNONE;
197 } else { /* Magic internal/external tag conversion. ORDER LJ_T */ 197 } else { /* Magic internal/external tag conversion. ORDER LJ_T */
198 int t = ~itype(o); 198 int t = ~itype(o);
199 return (int)(((t < 8 ? 0x98a42110 : 0x75b6) >> 4*(t&7)) & 15u); 199 lua_assert(itype(o) != LJ_TUPVAL);
200 return (int)(((t < 8 ? 0x98042110 : 0x7506) >> 4*(t&7)) & 15u);
200 } 201 }
201} 202}
202 203
@@ -631,7 +632,7 @@ LUALIB_API int luaL_newmetatable(lua_State *L, const char *tname)
631 GCtab *mt = lj_tab_new(L, 0, 1); 632 GCtab *mt = lj_tab_new(L, 0, 1);
632 settabV(L, tv, mt); 633 settabV(L, tv, mt);
633 settabV(L, L->top++, mt); 634 settabV(L, L->top++, mt);
634 lj_gc_objbarriert(L, regt, mt); 635 lj_gc_anybarriert(L, regt);
635 return 1; 636 return 1;
636 } else { 637 } else {
637 copyTV(L, L->top++, tv); 638 copyTV(L, L->top++, tv);
@@ -899,7 +900,7 @@ LUA_API void lua_rawset(lua_State *L, int idx)
899 key = L->top-2; 900 key = L->top-2;
900 dst = lj_tab_set(L, t, key); 901 dst = lj_tab_set(L, t, key);
901 copyTV(L, dst, key+1); 902 copyTV(L, dst, key+1);
902 lj_gc_barriert(L, t, dst); 903 lj_gc_anybarriert(L, t);
903 L->top = key; 904 L->top = key;
904} 905}
905 906