Skip to content

Commit

Permalink
Add a prefix to TaggedLuData flag to have it auto-enabled in flags ON…
Browse files Browse the repository at this point in the history
… mode (#1130)
  • Loading branch information
vegorov-rbx authored Dec 15, 2023
1 parent ff502f0 commit e76802f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions VM/src/lobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ int luaO_rawequalObj(const TValue* t1, const TValue* t2)
case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); // boolean true must be 1 !!
case LUA_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2) && (!FFlag::TaggedLuData || lightuserdatatag(t1) == lightuserdatatag(t2));
return pvalue(t1) == pvalue(t2) && (!FFlag::LuauTaggedLuData || lightuserdatatag(t1) == lightuserdatatag(t2));
default:
LUAU_ASSERT(iscollectable(t1));
return gcvalue(t1) == gcvalue(t2);
Expand All @@ -71,7 +71,7 @@ int luaO_rawequalKey(const TKey* t1, const TValue* t2)
case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); // boolean true must be 1 !!
case LUA_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2) && (!FFlag::TaggedLuData || lightuserdatatag(t1) == lightuserdatatag(t2));
return pvalue(t1) == pvalue(t2) && (!FFlag::LuauTaggedLuData || lightuserdatatag(t1) == lightuserdatatag(t2));
default:
LUAU_ASSERT(iscollectable(t1));
return gcvalue(t1) == gcvalue(t2);
Expand Down
4 changes: 2 additions & 2 deletions VM/src/lobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "lua.h"
#include "lcommon.h"

LUAU_FASTFLAG(LuauTaggedLuData)

/*
** Union of all collectible objects
*/
Expand Down Expand Up @@ -498,5 +500,3 @@ LUAI_FUNC int luaO_str2d(const char* s, double* result);
LUAI_FUNC const char* luaO_pushvfstring(lua_State* L, const char* fmt, va_list argp);
LUAI_FUNC const char* luaO_pushfstring(lua_State* L, const char* fmt, ...);
LUAI_FUNC const char* luaO_chunkid(char* buf, size_t buflen, const char* source, size_t srclen);

LUAU_FASTFLAG(TaggedLuData)
2 changes: 1 addition & 1 deletion VM/src/ltm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const TString* luaT_objtypenamestr(lua_State* L, const TValue* o)
if (ttisstring(type))
return tsvalue(type);
}
else if (FFlag::TaggedLuData && ttislightuserdata(o))
else if (FFlag::LuauTaggedLuData && ttislightuserdata(o))
{
int tag = lightuserdatatag(o);

Expand Down
6 changes: 3 additions & 3 deletions VM/src/lvmexecute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
// Does VM support native execution via ExecutionCallbacks? We mostly assume it does but keep the define to make it easy to quantify the cost.
#define VM_HAS_NATIVE 1

LUAU_FASTFLAGVARIABLE(TaggedLuData, false)
LUAU_FASTFLAGVARIABLE(LuauTaggedLuData, false)

LUAU_NOINLINE void luau_callhook(lua_State* L, lua_Hook hook, void* userdata)
{
Expand Down Expand Up @@ -1112,7 +1112,7 @@ static void luau_execute(lua_State* L)
VM_NEXT();

case LUA_TLIGHTUSERDATA:
pc += (pvalue(ra) == pvalue(rb) && (!FFlag::TaggedLuData || lightuserdatatag(ra) == lightuserdatatag(rb))) ? LUAU_INSN_D(insn) : 1;
pc += (pvalue(ra) == pvalue(rb) && (!FFlag::LuauTaggedLuData || lightuserdatatag(ra) == lightuserdatatag(rb))) ? LUAU_INSN_D(insn) : 1;
LUAU_ASSERT(unsigned(pc - cl->l.p->code) < unsigned(cl->l.p->sizecode));
VM_NEXT();

Expand Down Expand Up @@ -1227,7 +1227,7 @@ static void luau_execute(lua_State* L)
VM_NEXT();

case LUA_TLIGHTUSERDATA:
pc += (pvalue(ra) != pvalue(rb) || (FFlag::TaggedLuData && lightuserdatatag(ra) != lightuserdatatag(rb))) ? LUAU_INSN_D(insn) : 1;
pc += (pvalue(ra) != pvalue(rb) || (FFlag::LuauTaggedLuData && lightuserdatatag(ra) != lightuserdatatag(rb))) ? LUAU_INSN_D(insn) : 1;
LUAU_ASSERT(unsigned(pc - cl->l.p->code) < unsigned(cl->l.p->sizecode));
VM_NEXT();

Expand Down
2 changes: 1 addition & 1 deletion VM/src/lvmutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ int luaV_equalval(lua_State* L, const TValue* t1, const TValue* t2)
case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); // true must be 1 !!
case LUA_TLIGHTUSERDATA:
return pvalue(t1) == pvalue(t2) && (!FFlag::TaggedLuData || lightuserdatatag(t1) == lightuserdatatag(t2));
return pvalue(t1) == pvalue(t2) && (!FFlag::LuauTaggedLuData || lightuserdatatag(t1) == lightuserdatatag(t2));
case LUA_TUSERDATA:
{
tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, TM_EQ);
Expand Down
4 changes: 2 additions & 2 deletions tests/Conformance.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ LUAU_FASTFLAG(LuauBufferDefinitions);
LUAU_FASTFLAG(LuauCodeGenFixByteLower);
LUAU_FASTFLAG(LuauCompileBufferAnnotation);
LUAU_FASTFLAG(LuauLoopInterruptFix);
LUAU_FASTFLAG(TaggedLuData);
LUAU_FASTFLAG(LuauTaggedLuData);
LUAU_DYNAMIC_FASTFLAG(LuauStricterUtf8);
LUAU_FASTINT(CodegenHeuristicsInstructionLimit);

Expand Down Expand Up @@ -1703,7 +1703,7 @@ TEST_CASE("UserdataApi")

TEST_CASE("LightuserdataApi")
{
ScopedFastFlag taggedLuData{FFlag::TaggedLuData, true};
ScopedFastFlag luauTaggedLuData{FFlag::LuauTaggedLuData, true};

StateRef globalState(luaL_newstate(), lua_close);
lua_State* L = globalState.get();
Expand Down

0 comments on commit e76802f

Please sign in to comment.