Free bit 7 of GC 'marked' field
Tables were using this bit to indicate their array sizes were real
('isrealasize'), but this bit can be useful for tests. Instead, they
can use bit 7 of their 'flag' field for that purpose. (There are only
six fast-access metamethods.) This 'flag' field only exists in tables,
so this use does not affect other types.
This commit is contained in:
2
ltable.c
2
ltable.c
@@ -583,7 +583,7 @@ Table *luaH_new (lua_State *L) {
|
||||
GCObject *o = luaC_newobj(L, LUA_VTABLE, sizeof(Table));
|
||||
Table *t = gco2t(o);
|
||||
t->metatable = NULL;
|
||||
t->flags = cast_byte(~0);
|
||||
t->flags = cast_byte(maskflags); /* table has no metamethod fields */
|
||||
t->array = NULL;
|
||||
t->alimit = 0;
|
||||
setnodevector(L, t, 0);
|
||||
|
||||
Reference in New Issue
Block a user