mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Eliminate unnecessary LU_TAG_COUNT
This commit is contained in:
parent
9301d7fe11
commit
cc57a0afb2
3 changed files with 9 additions and 5 deletions
|
@ -84,7 +84,6 @@ typedef struct lua_TValue
|
||||||
|
|
||||||
// Internal tags used by the VM
|
// Internal tags used by the VM
|
||||||
#define LU_TAG_ITERATOR LUA_UTAG_LIMIT
|
#define LU_TAG_ITERATOR LUA_UTAG_LIMIT
|
||||||
#define LU_TAG_COUNT (LU_TAG_ITERATOR+1)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** for internal debug only
|
** for internal debug only
|
||||||
|
|
|
@ -197,7 +197,7 @@ typedef struct global_State
|
||||||
struct Table* mt[LUA_T_COUNT]; // metatables for basic types
|
struct Table* mt[LUA_T_COUNT]; // metatables for basic types
|
||||||
TString* ttname[LUA_T_COUNT]; // names for basic types
|
TString* ttname[LUA_T_COUNT]; // names for basic types
|
||||||
TString* tmname[TM_N]; // array with tag-method names
|
TString* tmname[TM_N]; // array with tag-method names
|
||||||
TString* lightuserdataname[LU_TAG_COUNT]; // names for tagged lightuserdata
|
TString* lightuserdataname[LUA_LUTAG_LIMIT]; // names for tagged lightuserdata
|
||||||
|
|
||||||
TValue pseudotemp; // storage for temporary values used in pseudo2addr
|
TValue pseudotemp; // storage for temporary values used in pseudo2addr
|
||||||
|
|
||||||
|
|
|
@ -131,11 +131,16 @@ const TString* luaT_objtypenamestr(lua_State* L, const TValue* o)
|
||||||
}
|
}
|
||||||
else if (ttislightuserdata(o))
|
else if (ttislightuserdata(o))
|
||||||
{
|
{
|
||||||
const TString* name = L->global->lightuserdataname[lightuserdatatag(o)];
|
int tag = lightuserdatatag(o);
|
||||||
|
|
||||||
|
if (unsigned(tag) < LUA_LUTAG_LIMIT)
|
||||||
|
{
|
||||||
|
const TString* name = L->global->lightuserdataname[tag];
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (Table* mt = L->global->mt[ttype(o)])
|
else if (Table* mt = L->global->mt[ttype(o)])
|
||||||
{
|
{
|
||||||
const TValue* type = luaH_getstr(mt, L->global->tmname[TM_TYPE]);
|
const TValue* type = luaH_getstr(mt, L->global->tmname[TM_TYPE]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue