diff options
author | Mike Pall <mike> | 2010-04-21 01:45:58 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-04-21 01:45:58 +0200 |
commit | ab45481199e9c9dd3efec922647bcec122504bcb (patch) | |
tree | 0484341edff50a0afe98133ad66fb6a59915996a /src/lj_api.c | |
parent | d8cb69ed076c3444258f63314662451c9d117cae (diff) | |
download | luajit2-ab45481199e9c9dd3efec922647bcec122504bcb.tar.gz |
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.c | 7 |
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) return LUA_TNONE; } else { /* Magic internal/external tag conversion. ORDER LJ_T */ int t = ~itype(o); - return (int)(((t < 8 ? 0x98a42110 : 0x75b6) >> 4*(t&7)) & 15u); + lua_assert(itype(o) != LJ_TUPVAL); + return (int)(((t < 8 ? 0x98042110 : 0x7506) >> 4*(t&7)) & 15u); } } @@ -631,7 +632,7 @@ LUALIB_API int luaL_newmetatable(lua_State *L, const char *tname) GCtab *mt = lj_tab_new(L, 0, 1); settabV(L, tv, mt); settabV(L, L->top++, mt); - lj_gc_objbarriert(L, regt, mt); + lj_gc_anybarriert(L, regt); return 1; } else { copyTV(L, L->top++, tv); @@ -899,7 +900,7 @@ LUA_API void lua_rawset(lua_State *L, int idx) key = L->top-2; dst = lj_tab_set(L, t, key); copyTV(L, dst, key+1); - lj_gc_barriert(L, t, dst); + lj_gc_anybarriert(L, t); L->top = key; } |