From 4e218913ccf0b39804c349f321e07c3cbd2bda30 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 22 Nov 2025 13:43:39 +0000 Subject: [PATCH 1/2] Phase 122: Remove unused ctb(int) overload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed the `lu_byte ctb(int)` overload from ltvalue.h as it was unused. All ctb() calls in the codebase use LuaT enum values, which call the `LuaT ctb(LuaT)` overload. This simplifies the API and removes dead code. Analysis: - Searched codebase for all ctb() calls - All calls use LuaT::* enum values (SHRSTR, LNGSTR, etc.) - Calls like ctb(s->getType()) pass LuaT (from GCBase::getType()) - No integer literals or LUA_T* macros passed to ctb() Changes: - src/objects/ltvalue.h:318 - Removed ctb(int) overload Testing: - Build: ✅ Success (no compilation errors) - Tests: ✅ All pass ("final OK !!!") - Performance: ~4.46s avg (within normal variance) --- src/objects/ltvalue.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/objects/ltvalue.h b/src/objects/ltvalue.h index b39c07e0..56a6b7a8 100644 --- a/src/objects/ltvalue.h +++ b/src/objects/ltvalue.h @@ -315,7 +315,6 @@ inline constexpr int BIT_ISCOLLECTABLE = (1 << 6); /* mark a tag as collectable */ constexpr LuaT ctb(LuaT t) noexcept { return static_cast(static_cast(t) | BIT_ISCOLLECTABLE); } -constexpr lu_byte ctb(int t) noexcept { return static_cast(t | BIT_ISCOLLECTABLE); } /* overload for base types */ /* Macros for internal tests */ From 0ca0e30cff0a3f0dcc147332b0e28b87e0834bcc Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 22 Nov 2025 13:48:18 +0000 Subject: [PATCH 2/2] Phase 122: Remove 6 additional unused legacy functions from ltvalue.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed unused legacy helper functions and lu_byte overloads: 1. val_() - Old Value accessor (4 overloads) - 0 usages 2. valraw() - Old Value accessor wrapper (2 overloads) - 0 usages 3. rawtt_byte() - lu_byte version of rawtt - 0 usages 4. ttypetag_byte() - lu_byte version of ttypetag - 0 usages 5. checktag(const TValue* o, lu_byte t) - lu_byte overload - 0 usages 6. settt_(TValue* o, lu_byte t) - lu_byte overload - 0 usages All current callers use LuaT enum types, making these legacy lu_byte overloads and wrappers unnecessary. This continues the modernization from Phase 122 Part 1 (removing ctb(int) overload). Analysis: - Searched codebase for usage of each function - All are either completely unused or have LuaT-based alternatives - All current checktag() calls use LuaT arguments - All current settt_() calls use LuaT arguments Changes: - src/objects/ltvalue.h: Removed 6 legacy functions/overloads - Total lines removed: 10 Testing: - Build: ✅ Success (no compilation errors) - Tests: ✅ All pass ("final OK !!!") - Performance: ~4.52s avg (within normal variance) --- src/objects/ltvalue.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/objects/ltvalue.h b/src/objects/ltvalue.h index 56a6b7a8..39952845 100644 --- a/src/objects/ltvalue.h +++ b/src/objects/ltvalue.h @@ -276,16 +276,8 @@ class TValue { }; -/* Access to TValue's internal value union */ -constexpr Value& val_(TValue* o) noexcept { return o->valueField(); } -constexpr const Value& val_(const TValue* o) noexcept { return o->valueField(); } -constexpr Value& valraw(TValue* o) noexcept { return val_(o); } -constexpr const Value& valraw(const TValue* o) noexcept { return val_(o); } - - /* raw type tag of a TValue */ constexpr LuaT rawtt(const TValue* o) noexcept { return o->getType(); } -constexpr lu_byte rawtt_byte(const TValue* o) noexcept { return o->getRawType(); } /* for legacy code */ /* tag with no variants (bits 0-3) */ constexpr int novariant(int t) noexcept { return (t & 0x0F); } @@ -296,7 +288,6 @@ constexpr int withvariant(int t) noexcept { return (t & 0x3F); } constexpr LuaT withvariant(LuaT t) noexcept { return static_cast(static_cast(t) & 0x3F); } constexpr LuaT ttypetag(const TValue* o) noexcept { return withvariant(rawtt(o)); } -constexpr lu_byte ttypetag_byte(const TValue* o) noexcept { return static_cast(withvariant(rawtt(o))); } /* for legacy code */ /* type of a TValue */ constexpr int ttype(const TValue* o) noexcept { return novariant(rawtt(o)); } @@ -307,7 +298,6 @@ constexpr LuaT TValue::typeTag() const noexcept { return withvariant(tt_); } /* Macros to test type */ constexpr bool checktag(const TValue* o, LuaT t) noexcept { return rawtt(o) == t; } -constexpr bool checktag(const TValue* o, lu_byte t) noexcept { return rawtt(o) == static_cast(t); } /* overload for raw bytes */ constexpr bool checktype(const TValue* o, int t) noexcept { return ttype(o) == t; } /* Bit mark for collectable types */ @@ -326,7 +316,6 @@ constexpr LuaT ctb(LuaT t) noexcept { return static_cast(static_cast( /* set a value's tag */ inline void settt_(TValue* o, LuaT t) noexcept { o->setType(t); } -inline void settt_(TValue* o, lu_byte t) noexcept { o->setType(t); } /* overload for raw bytes */ #endif