From b44123c145f9a67e79fa349bd1455fe011e8c795 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 22 Nov 2025 11:02:01 +0000 Subject: [PATCH] Phase 122: Remove redundant inline specifiers from class member functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed redundant 'inline' keywords from member functions defined inside class bodies. In C++, such functions are implicitly inline, making the explicit keyword unnecessary and verbose. Changes: - ltable.h: Node class (20 methods), Table class (8 methods) - lproto.h: ProtoDebugInfo (29 methods), Proto (58 methods) - lparser.h: Labellist (11 methods), Dyndata (11 methods), ActvarAccessor (4 methods), CodeBuffer (13 methods), ConstantPool (5 methods), VariableScope (7 methods), RegisterAllocator (4 methods), UpvalueTracker (4 methods) - lstack.h: LuaStack class (19 methods) - llex.h: InputScanner (11 methods), TokenState (4 methods), StringInterner (10 methods) Total: ~218 redundant inline specifiers removed across 5 header files. This change improves code clarity without affecting performance. Member functions defined within class bodies are implicitly inline per C++ standard. Note: Free functions and member functions defined outside class bodies still require explicit 'inline' to avoid ODR violations. Performance: 4.33s avg (5 runs: 4.70s, 4.25s, 4.15s, 4.34s, 4.20s) Target: ≤4.33s ✅ Tests: All passing ✅ --- src/compiler/llex.h | 56 ++++++------ src/compiler/lparser.h | 152 +++++++++++++++---------------- src/core/lstack.h | 62 ++++++------- src/objects/lproto.h | 200 ++++++++++++++++++++--------------------- src/objects/ltable.h | 64 ++++++------- 5 files changed, 267 insertions(+), 267 deletions(-) diff --git a/src/compiler/llex.h b/src/compiler/llex.h index efebb93c..6bf12165 100644 --- a/src/compiler/llex.h +++ b/src/compiler/llex.h @@ -99,23 +99,23 @@ class InputScanner { public: // Accessors - inline int getCurrent() const noexcept { return current; } - inline int getLineNumber() const noexcept { return linenumber; } - inline int getLastLine() const noexcept { return lastline; } - inline ZIO* getZIO() const noexcept { return z; } - inline TString* getSource() const noexcept { return source; } + int getCurrent() const noexcept { return current; } + int getLineNumber() const noexcept { return linenumber; } + int getLastLine() const noexcept { return lastline; } + ZIO* getZIO() const noexcept { return z; } + TString* getSource() const noexcept { return source; } - inline void setCurrent(int c) noexcept { current = c; } - inline void setLineNumber(int line) noexcept { linenumber = line; } - inline void setLastLine(int line) noexcept { lastline = line; } - inline void setZIO(ZIO* zio) noexcept { z = zio; } - inline void setSource(TString* src) noexcept { source = src; } + void setCurrent(int c) noexcept { current = c; } + void setLineNumber(int line) noexcept { linenumber = line; } + void setLastLine(int line) noexcept { lastline = line; } + void setZIO(ZIO* zio) noexcept { z = zio; } + void setSource(TString* src) noexcept { source = src; } - inline int& getLineNumberRef() noexcept { return linenumber; } + int& getLineNumberRef() noexcept { return linenumber; } // Operations - inline void next() noexcept { current = zgetc(z); } - inline bool currIsNewline() const noexcept { return current == '\n' || current == '\r'; } + void next() noexcept { current = zgetc(z); } + bool currIsNewline() const noexcept { return current == '\n' || current == '\r'; } }; /* Phase 94: Subsystem for token state management */ @@ -126,10 +126,10 @@ class TokenState { public: // Accessors - inline const Token& getCurrent() const noexcept { return current; } - inline Token& getCurrentRef() noexcept { return current; } - inline const Token& getLookahead() const noexcept { return lookahead; } - inline Token& getLookaheadRef() noexcept { return lookahead; } + const Token& getCurrent() const noexcept { return current; } + Token& getCurrentRef() noexcept { return current; } + const Token& getLookahead() const noexcept { return lookahead; } + Token& getLookaheadRef() noexcept { return lookahead; } }; /* Phase 94: Subsystem for string interning and buffer management */ @@ -143,17 +143,17 @@ class StringInterner { public: // Accessors - inline Mbuffer* getBuffer() const noexcept { return buff; } - inline Table* getTable() const noexcept { return h; } - inline TString* getEnvName() const noexcept { return envn; } - inline TString* getBreakName() const noexcept { return brkn; } - inline TString* getGlobalName() const noexcept { return glbn; } - - inline void setBuffer(Mbuffer* b) noexcept { buff = b; } - inline void setTable(Table* table) noexcept { h = table; } - inline void setEnvName(TString* env) noexcept { envn = env; } - inline void setBreakName(TString* brk) noexcept { brkn = brk; } - inline void setGlobalName(TString* gbl) noexcept { glbn = gbl; } + Mbuffer* getBuffer() const noexcept { return buff; } + Table* getTable() const noexcept { return h; } + TString* getEnvName() const noexcept { return envn; } + TString* getBreakName() const noexcept { return brkn; } + TString* getGlobalName() const noexcept { return glbn; } + + void setBuffer(Mbuffer* b) noexcept { buff = b; } + void setTable(Table* table) noexcept { h = table; } + void setEnvName(TString* env) noexcept { envn = env; } + void setBreakName(TString* brk) noexcept { brkn = brk; } + void setGlobalName(TString* gbl) noexcept { glbn = gbl; } }; /* Phase 95: Lexical state - focused on tokenization only diff --git a/src/compiler/lparser.h b/src/compiler/lparser.h index 506f22f0..3a006aee 100644 --- a/src/compiler/lparser.h +++ b/src/compiler/lparser.h @@ -221,27 +221,27 @@ class Labellist { } /* Accessor methods matching old interface */ - inline Labeldesc* getArr() noexcept { return vec.data(); } - inline const Labeldesc* getArr() const noexcept { return vec.data(); } - inline int getN() const noexcept { return static_cast(vec.size()); } - inline int getSize() const noexcept { return static_cast(vec.capacity()); } + Labeldesc* getArr() noexcept { return vec.data(); } + const Labeldesc* getArr() const noexcept { return vec.data(); } + int getN() const noexcept { return static_cast(vec.size()); } + int getSize() const noexcept { return static_cast(vec.capacity()); } /* Modifying size */ - inline void setN(int new_n) { vec.resize(static_cast(new_n)); } + void setN(int new_n) { vec.resize(static_cast(new_n)); } /* Direct vector access for modern operations */ - inline void push_back(const Labeldesc& desc) { vec.push_back(desc); } - inline void reserve(int capacity) { vec.reserve(static_cast(capacity)); } - inline Labeldesc& operator[](int index) { return vec[static_cast(index)]; } - inline const Labeldesc& operator[](int index) const { return vec[static_cast(index)]; } + void push_back(const Labeldesc& desc) { vec.push_back(desc); } + void reserve(int capacity) { vec.reserve(static_cast(capacity)); } + Labeldesc& operator[](int index) { return vec[static_cast(index)]; } + const Labeldesc& operator[](int index) const { return vec[static_cast(index)]; } /* For luaM_growvector replacement */ - inline void ensureCapacity(int needed) { + void ensureCapacity(int needed) { if (needed > getSize()) { vec.reserve(static_cast(needed)); } } - inline Labeldesc* allocateNew() { + Labeldesc* allocateNew() { vec.resize(vec.size() + 1); return &vec.back(); } @@ -264,25 +264,25 @@ class Dyndata { } /* Direct actvar accessor methods - avoid temporary object creation */ - inline Vardesc* actvarGetArr() noexcept { return actvar_vec.data(); } - inline const Vardesc* actvarGetArr() const noexcept { return actvar_vec.data(); } - inline int actvarGetN() const noexcept { return static_cast(actvar_vec.size()); } - inline int actvarGetSize() const noexcept { return static_cast(actvar_vec.capacity()); } + Vardesc* actvarGetArr() noexcept { return actvar_vec.data(); } + const Vardesc* actvarGetArr() const noexcept { return actvar_vec.data(); } + int actvarGetN() const noexcept { return static_cast(actvar_vec.size()); } + int actvarGetSize() const noexcept { return static_cast(actvar_vec.capacity()); } - inline void actvarSetN(int new_n) { actvar_vec.resize(static_cast(new_n)); } - inline Vardesc& actvarAt(int index) { return actvar_vec[static_cast(index)]; } - inline const Vardesc& actvarAt(int index) const { return actvar_vec[static_cast(index)]; } + void actvarSetN(int new_n) { actvar_vec.resize(static_cast(new_n)); } + Vardesc& actvarAt(int index) { return actvar_vec[static_cast(index)]; } + const Vardesc& actvarAt(int index) const { return actvar_vec[static_cast(index)]; } - inline Vardesc* actvarAllocateNew() { + Vardesc* actvarAllocateNew() { actvar_vec.resize(actvar_vec.size() + 1); return &actvar_vec.back(); } /* Phase 116: std::span accessors for actvar array */ - inline std::span actvarGetSpan() noexcept { + std::span actvarGetSpan() noexcept { return std::span(actvar_vec.data(), actvar_vec.size()); } - inline std::span actvarGetSpan() const noexcept { + std::span actvarGetSpan() const noexcept { return std::span(actvar_vec.data(), actvar_vec.size()); } @@ -292,13 +292,13 @@ class Dyndata { Dyndata* dyn; public: explicit ActvarAccessor(Dyndata* d) : dyn(d) {} - inline int getN() const noexcept { return dyn->actvarGetN(); } - inline void setN(int n) { dyn->actvarSetN(n); } - inline Vardesc& operator[](int i) { return dyn->actvarAt(i); } - inline Vardesc* allocateNew() { return dyn->actvarAllocateNew(); } + int getN() const noexcept { return dyn->actvarGetN(); } + void setN(int n) { dyn->actvarSetN(n); } + Vardesc& operator[](int i) { return dyn->actvarAt(i); } + Vardesc* allocateNew() { return dyn->actvarAllocateNew(); } }; - inline ActvarAccessor actvar() noexcept { return ActvarAccessor{this}; } + ActvarAccessor actvar() noexcept { return ActvarAccessor{this}; } }; @@ -324,35 +324,35 @@ class CodeBuffer { public: /* Inline accessors for reading */ - inline int getPC() const noexcept { return pc; } - inline int getLastTarget() const noexcept { return lasttarget; } - inline int getPreviousLine() const noexcept { return previousline; } - inline int getNAbsLineInfo() const noexcept { return nabslineinfo; } - inline lu_byte getInstructionsWithAbs() const noexcept { return iwthabs; } + int getPC() const noexcept { return pc; } + int getLastTarget() const noexcept { return lasttarget; } + int getPreviousLine() const noexcept { return previousline; } + int getNAbsLineInfo() const noexcept { return nabslineinfo; } + lu_byte getInstructionsWithAbs() const noexcept { return iwthabs; } /* Setters */ - inline void setPC(int pc_) noexcept { pc = pc_; } - inline void setLastTarget(int lasttarget_) noexcept { lasttarget = lasttarget_; } - inline void setPreviousLine(int previousline_) noexcept { previousline = previousline_; } - inline void setNAbsLineInfo(int nabslineinfo_) noexcept { nabslineinfo = nabslineinfo_; } - inline void setInstructionsWithAbs(lu_byte iwthabs_) noexcept { iwthabs = iwthabs_; } + void setPC(int pc_) noexcept { pc = pc_; } + void setLastTarget(int lasttarget_) noexcept { lasttarget = lasttarget_; } + void setPreviousLine(int previousline_) noexcept { previousline = previousline_; } + void setNAbsLineInfo(int nabslineinfo_) noexcept { nabslineinfo = nabslineinfo_; } + void setInstructionsWithAbs(lu_byte iwthabs_) noexcept { iwthabs = iwthabs_; } /* Increment/decrement methods */ - inline void incrementPC() noexcept { pc++; } - inline void decrementPC() noexcept { pc--; } - inline int postIncrementPC() noexcept { return pc++; } - inline void incrementNAbsLineInfo() noexcept { nabslineinfo++; } - inline void decrementNAbsLineInfo() noexcept { nabslineinfo--; } - inline int postIncrementNAbsLineInfo() noexcept { return nabslineinfo++; } - inline lu_byte postIncrementInstructionsWithAbs() noexcept { return iwthabs++; } - inline void decrementInstructionsWithAbs() noexcept { iwthabs--; } + void incrementPC() noexcept { pc++; } + void decrementPC() noexcept { pc--; } + int postIncrementPC() noexcept { return pc++; } + void incrementNAbsLineInfo() noexcept { nabslineinfo++; } + void decrementNAbsLineInfo() noexcept { nabslineinfo--; } + int postIncrementNAbsLineInfo() noexcept { return nabslineinfo++; } + lu_byte postIncrementInstructionsWithAbs() noexcept { return iwthabs++; } + void decrementInstructionsWithAbs() noexcept { iwthabs--; } /* Reference accessors for compound assignments */ - inline int& getPCRef() noexcept { return pc; } - inline int& getLastTargetRef() noexcept { return lasttarget; } - inline int& getPreviousLineRef() noexcept { return previousline; } - inline int& getNAbsLineInfoRef() noexcept { return nabslineinfo; } - inline lu_byte& getInstructionsWithAbsRef() noexcept { return iwthabs; } + int& getPCRef() noexcept { return pc; } + int& getLastTargetRef() noexcept { return lasttarget; } + int& getPreviousLineRef() noexcept { return previousline; } + int& getNAbsLineInfoRef() noexcept { return nabslineinfo; } + lu_byte& getInstructionsWithAbsRef() noexcept { return iwthabs; } }; @@ -364,17 +364,17 @@ class ConstantPool { public: /* Inline accessors */ - inline Table* getCache() const noexcept { return cache; } - inline int getCount() const noexcept { return count; } + Table* getCache() const noexcept { return cache; } + int getCount() const noexcept { return count; } - inline void setCache(Table* cache_) noexcept { cache = cache_; } - inline void setCount(int count_) noexcept { count = count_; } + void setCache(Table* cache_) noexcept { cache = cache_; } + void setCount(int count_) noexcept { count = count_; } /* Increment */ - inline void incrementCount() noexcept { count++; } + void incrementCount() noexcept { count++; } /* Reference accessor */ - inline int& getCountRef() noexcept { return count; } + int& getCountRef() noexcept { return count; } }; @@ -388,22 +388,22 @@ class VariableScope { public: /* Inline accessors */ - inline int getFirstLocal() const noexcept { return firstlocal; } - inline int getFirstLabel() const noexcept { return firstlabel; } - inline short getNumDebugVars() const noexcept { return ndebugvars; } - inline short getNumActiveVars() const noexcept { return nactvar; } + int getFirstLocal() const noexcept { return firstlocal; } + int getFirstLabel() const noexcept { return firstlabel; } + short getNumDebugVars() const noexcept { return ndebugvars; } + short getNumActiveVars() const noexcept { return nactvar; } - inline void setFirstLocal(int firstlocal_) noexcept { firstlocal = firstlocal_; } - inline void setFirstLabel(int firstlabel_) noexcept { firstlabel = firstlabel_; } - inline void setNumDebugVars(short ndebugvars_) noexcept { ndebugvars = ndebugvars_; } - inline void setNumActiveVars(short nactvar_) noexcept { nactvar = nactvar_; } + void setFirstLocal(int firstlocal_) noexcept { firstlocal = firstlocal_; } + void setFirstLabel(int firstlabel_) noexcept { firstlabel = firstlabel_; } + void setNumDebugVars(short ndebugvars_) noexcept { ndebugvars = ndebugvars_; } + void setNumActiveVars(short nactvar_) noexcept { nactvar = nactvar_; } /* Increment */ - inline short postIncrementNumDebugVars() noexcept { return ndebugvars++; } + short postIncrementNumDebugVars() noexcept { return ndebugvars++; } /* Reference accessors */ - inline short& getNumDebugVarsRef() noexcept { return ndebugvars; } - inline short& getNumActiveVarsRef() noexcept { return nactvar; } + short& getNumDebugVarsRef() noexcept { return ndebugvars; } + short& getNumActiveVarsRef() noexcept { return nactvar; } }; @@ -414,14 +414,14 @@ class RegisterAllocator { public: /* Inline accessors */ - inline lu_byte getFreeReg() const noexcept { return freereg; } - inline void setFreeReg(lu_byte freereg_) noexcept { freereg = freereg_; } + lu_byte getFreeReg() const noexcept { return freereg; } + void setFreeReg(lu_byte freereg_) noexcept { freereg = freereg_; } /* Decrement */ - inline void decrementFreeReg() noexcept { freereg--; } + void decrementFreeReg() noexcept { freereg--; } /* Reference accessor */ - inline lu_byte& getFreeRegRef() noexcept { return freereg; } + lu_byte& getFreeRegRef() noexcept { return freereg; } }; @@ -433,15 +433,15 @@ class UpvalueTracker { public: /* Inline accessors */ - inline lu_byte getNumUpvalues() const noexcept { return nups; } - inline lu_byte getNeedClose() const noexcept { return needclose; } + lu_byte getNumUpvalues() const noexcept { return nups; } + lu_byte getNeedClose() const noexcept { return needclose; } - inline void setNumUpvalues(lu_byte nups_) noexcept { nups = nups_; } - inline void setNeedClose(lu_byte needclose_) noexcept { needclose = needclose_; } + void setNumUpvalues(lu_byte nups_) noexcept { nups = nups_; } + void setNeedClose(lu_byte needclose_) noexcept { needclose = needclose_; } /* Reference accessors */ - inline lu_byte& getNumUpvaluesRef() noexcept { return nups; } - inline lu_byte& getNeedCloseRef() noexcept { return needclose; } + lu_byte& getNumUpvaluesRef() noexcept { return nups; } + lu_byte& getNeedCloseRef() noexcept { return needclose; } }; diff --git a/src/core/lstack.h b/src/core/lstack.h index 435f7199..e883458e 100644 --- a/src/core/lstack.h +++ b/src/core/lstack.h @@ -74,36 +74,36 @@ class LuaStack { */ /* Top pointer accessors */ - inline StkIdRel& getTop() noexcept { return top; } - inline const StkIdRel& getTop() const noexcept { return top; } - inline void setTop(StkIdRel t) noexcept { top = t; } + StkIdRel& getTop() noexcept { return top; } + const StkIdRel& getTop() const noexcept { return top; } + void setTop(StkIdRel t) noexcept { top = t; } /* Stack base pointer accessors */ - inline StkIdRel& getStack() noexcept { return stack; } - inline const StkIdRel& getStack() const noexcept { return stack; } - inline void setStack(StkIdRel s) noexcept { stack = s; } + StkIdRel& getStack() noexcept { return stack; } + const StkIdRel& getStack() const noexcept { return stack; } + void setStack(StkIdRel s) noexcept { stack = s; } /* Stack limit pointer accessors */ - inline StkIdRel& getStackLast() noexcept { return stack_last; } - inline const StkIdRel& getStackLast() const noexcept { return stack_last; } - inline void setStackLast(StkIdRel sl) noexcept { stack_last = sl; } + StkIdRel& getStackLast() noexcept { return stack_last; } + const StkIdRel& getStackLast() const noexcept { return stack_last; } + void setStackLast(StkIdRel sl) noexcept { stack_last = sl; } /* To-be-closed list pointer accessors */ - inline StkIdRel& getTbclist() noexcept { return tbclist; } - inline const StkIdRel& getTbclist() const noexcept { return tbclist; } - inline void setTbclist(StkIdRel tbc) noexcept { tbclist = tbc; } + StkIdRel& getTbclist() noexcept { return tbclist; } + const StkIdRel& getTbclist() const noexcept { return tbclist; } + void setTbclist(StkIdRel tbc) noexcept { tbclist = tbc; } /* ** Computed properties */ /* Get current stack size (number of usable slots) */ - inline int getSize() const noexcept { + int getSize() const noexcept { return cast_int(stack_last.p - stack.p); } /* Check if there is space for n more elements */ - inline bool hasSpace(int n) const noexcept { + bool hasSpace(int n) const noexcept { return stack_last.p - top.p > n; } @@ -115,12 +115,12 @@ class LuaStack { */ /* Convert stack pointer to offset from base */ - inline ptrdiff_t save(StkId pt) const noexcept { + ptrdiff_t save(StkId pt) const noexcept { return pt - stack.p; /* direct pointer arithmetic, no char* round-trip */ } /* Convert offset to stack pointer */ - inline StkId restore(ptrdiff_t n) const noexcept { + StkId restore(ptrdiff_t n) const noexcept { return stack.p + n; /* direct pointer arithmetic, safe with LTO */ } @@ -133,32 +133,32 @@ class LuaStack { */ /* Push one slot (increment top) */ - inline void push() noexcept { + void push() noexcept { top.p++; } /* Pop one slot (decrement top) */ - inline void pop() noexcept { + void pop() noexcept { top.p--; } /* Pop n slots from stack */ - inline void popN(int n) noexcept { + void popN(int n) noexcept { top.p -= n; } /* Adjust top by n (positive or negative) */ - inline void adjust(int n) noexcept { + void adjust(int n) noexcept { top.p += n; } /* Set top to specific pointer value */ - inline void setTopPtr(StkId ptr) noexcept { + void setTopPtr(StkId ptr) noexcept { top.p = ptr; } /* Set top to offset from stack base */ - inline void setTopOffset(int offset) noexcept { + void setTopOffset(int offset) noexcept { top.p = stack.p + offset; } @@ -170,7 +170,7 @@ class LuaStack { */ /* Push with bounds check (replaces api_incr_top macro) */ - inline void pushChecked(StkId limit) noexcept { + void pushChecked(StkId limit) noexcept { top.p++; lua_assert(top.p <= limit); } @@ -205,7 +205,7 @@ class LuaStack { */ /* Ensure space for n elements (replaces luaD_checkstack) */ - inline int ensureSpace(lua_State* L, int n) { + int ensureSpace(lua_State* L, int n) { if (l_unlikely(stack_last.p - top.p <= n)) { return grow(L, n, 1); } @@ -220,7 +220,7 @@ class LuaStack { /* Ensure space preserving pointer (replaces checkstackp) */ template - inline T* ensureSpaceP(lua_State* L, int n, T* ptr) { + T* ensureSpaceP(lua_State* L, int n, T* ptr) { if (l_unlikely(stack_last.p - top.p <= n)) { ptrdiff_t offset = save(reinterpret_cast(ptr)); grow(L, n, 1); @@ -261,12 +261,12 @@ class LuaStack { */ /* Available space before stack_last */ - inline int getAvailable() const noexcept { + int getAvailable() const noexcept { return cast_int(stack_last.p - top.p); } /* Current depth (elements from base to top) */ - inline int getDepth() const noexcept { + int getDepth() const noexcept { return cast_int(top.p - stack.p); } @@ -274,7 +274,7 @@ class LuaStack { int getDepthFromFunc(CallInfo* ci) const noexcept; /* Check if can fit n elements (alias for hasSpace) */ - inline bool canFit(int n) const noexcept { + bool canFit(int n) const noexcept { return stack_last.p - top.p > n; } @@ -286,19 +286,19 @@ class LuaStack { */ /* Get TValue at absolute offset from stack base (0-indexed) */ - inline TValue* at(int offset) noexcept { + TValue* at(int offset) noexcept { lua_assert(offset >= 0 && stack.p + offset < top.p); return s2v(stack.p + offset); } /* Get TValue at offset from top (-1 = top element) */ - inline TValue* fromTop(int offset) noexcept { + TValue* fromTop(int offset) noexcept { lua_assert(offset <= 0 && top.p + offset >= stack.p); return s2v(top.p + offset); } /* Get top-most TValue (top - 1) */ - inline TValue* topValue() noexcept { + TValue* topValue() noexcept { lua_assert(top.p > stack.p); return s2v(top.p - 1); } diff --git a/src/objects/lproto.h b/src/objects/lproto.h index 87dc3a89..1d47a479 100644 --- a/src/objects/lproto.h +++ b/src/objects/lproto.h @@ -138,57 +138,57 @@ class ProtoDebugInfo { public: /* Inline accessors */ - inline ls_byte* getLineInfo() const noexcept { return lineinfo; } - inline int getLineInfoSize() const noexcept { return sizelineinfo; } - inline AbsLineInfo* getAbsLineInfo() const noexcept { return abslineinfo; } - inline int getAbsLineInfoSize() const noexcept { return sizeabslineinfo; } - inline LocVar* getLocVars() const noexcept { return locvars; } - inline int getLocVarsSize() const noexcept { return sizelocvars; } - inline int getLineDefined() const noexcept { return linedefined; } - inline int getLastLineDefined() const noexcept { return lastlinedefined; } - inline TString* getSource() const noexcept { return source; } + ls_byte* getLineInfo() const noexcept { return lineinfo; } + int getLineInfoSize() const noexcept { return sizelineinfo; } + AbsLineInfo* getAbsLineInfo() const noexcept { return abslineinfo; } + int getAbsLineInfoSize() const noexcept { return sizeabslineinfo; } + LocVar* getLocVars() const noexcept { return locvars; } + int getLocVarsSize() const noexcept { return sizelocvars; } + int getLineDefined() const noexcept { return linedefined; } + int getLastLineDefined() const noexcept { return lastlinedefined; } + TString* getSource() const noexcept { return source; } /* Inline setters */ - inline void setLineInfo(ls_byte* li) noexcept { lineinfo = li; } - inline void setLineInfoSize(int s) noexcept { sizelineinfo = s; } - inline void setAbsLineInfo(AbsLineInfo* ali) noexcept { abslineinfo = ali; } - inline void setAbsLineInfoSize(int s) noexcept { sizeabslineinfo = s; } - inline void setLocVars(LocVar* lv) noexcept { locvars = lv; } - inline void setLocVarsSize(int s) noexcept { sizelocvars = s; } - inline void setLineDefined(int l) noexcept { linedefined = l; } - inline void setLastLineDefined(int l) noexcept { lastlinedefined = l; } - inline void setSource(TString* s) noexcept { source = s; } + void setLineInfo(ls_byte* li) noexcept { lineinfo = li; } + void setLineInfoSize(int s) noexcept { sizelineinfo = s; } + void setAbsLineInfo(AbsLineInfo* ali) noexcept { abslineinfo = ali; } + void setAbsLineInfoSize(int s) noexcept { sizeabslineinfo = s; } + void setLocVars(LocVar* lv) noexcept { locvars = lv; } + void setLocVarsSize(int s) noexcept { sizelocvars = s; } + void setLineDefined(int l) noexcept { linedefined = l; } + void setLastLineDefined(int l) noexcept { lastlinedefined = l; } + void setSource(TString* s) noexcept { source = s; } /* Reference accessors for luaM_growvector */ - inline int& getLineInfoSizeRef() noexcept { return sizelineinfo; } - inline int& getAbsLineInfoSizeRef() noexcept { return sizeabslineinfo; } - inline int& getLocVarsSizeRef() noexcept { return sizelocvars; } - inline ls_byte*& getLineInfoRef() noexcept { return lineinfo; } - inline AbsLineInfo*& getAbsLineInfoRef() noexcept { return abslineinfo; } - inline LocVar*& getLocVarsRef() noexcept { return locvars; } + int& getLineInfoSizeRef() noexcept { return sizelineinfo; } + int& getAbsLineInfoSizeRef() noexcept { return sizeabslineinfo; } + int& getLocVarsSizeRef() noexcept { return sizelocvars; } + ls_byte*& getLineInfoRef() noexcept { return lineinfo; } + AbsLineInfo*& getAbsLineInfoRef() noexcept { return abslineinfo; } + LocVar*& getLocVarsRef() noexcept { return locvars; } /* Pointer accessors */ - inline TString** getSourcePtr() noexcept { return &source; } + TString** getSourcePtr() noexcept { return &source; } /* Phase 112: std::span accessors for debug info arrays */ - inline std::span getLineInfoSpan() noexcept { + std::span getLineInfoSpan() noexcept { return std::span(lineinfo, static_cast(sizelineinfo)); } - inline std::span getLineInfoSpan() const noexcept { + std::span getLineInfoSpan() const noexcept { return std::span(lineinfo, static_cast(sizelineinfo)); } - inline std::span getAbsLineInfoSpan() noexcept { + std::span getAbsLineInfoSpan() noexcept { return std::span(abslineinfo, static_cast(sizeabslineinfo)); } - inline std::span getAbsLineInfoSpan() const noexcept { + std::span getAbsLineInfoSpan() const noexcept { return std::span(abslineinfo, static_cast(sizeabslineinfo)); } - inline std::span getLocVarsSpan() noexcept { + std::span getLocVarsSpan() noexcept { return std::span(locvars, static_cast(sizelocvars)); } - inline std::span getLocVarsSpan() const noexcept { + std::span getLocVarsSpan() const noexcept { return std::span(locvars, static_cast(sizelocvars)); } }; @@ -256,112 +256,112 @@ class Proto : public GCBase { static void operator delete(void*) = delete; /* Subsystem access (for direct debug info manipulation) */ - inline ProtoDebugInfo& getDebugInfo() noexcept { return debugInfo; } - inline const ProtoDebugInfo& getDebugInfo() const noexcept { return debugInfo; } + ProtoDebugInfo& getDebugInfo() noexcept { return debugInfo; } + const ProtoDebugInfo& getDebugInfo() const noexcept { return debugInfo; } /* Runtime data accessors */ - inline lu_byte getNumParams() const noexcept { return numparams; } - inline lu_byte getFlag() const noexcept { return flag; } - inline lu_byte getMaxStackSize() const noexcept { return maxstacksize; } - inline int getCodeSize() const noexcept { return sizecode; } - inline int getConstantsSize() const noexcept { return sizek; } - inline int getUpvaluesSize() const noexcept { return sizeupvalues; } - inline int getProtosSize() const noexcept { return sizep; } - inline bool isVarArg() const noexcept { return flag != 0; } - inline Instruction* getCode() const noexcept { return code; } - inline TValue* getConstants() const noexcept { return k; } + lu_byte getNumParams() const noexcept { return numparams; } + lu_byte getFlag() const noexcept { return flag; } + lu_byte getMaxStackSize() const noexcept { return maxstacksize; } + int getCodeSize() const noexcept { return sizecode; } + int getConstantsSize() const noexcept { return sizek; } + int getUpvaluesSize() const noexcept { return sizeupvalues; } + int getProtosSize() const noexcept { return sizep; } + bool isVarArg() const noexcept { return flag != 0; } + Instruction* getCode() const noexcept { return code; } + TValue* getConstants() const noexcept { return k; } /* Phase 112: std::span accessors for arrays */ - inline std::span getCodeSpan() noexcept { + std::span getCodeSpan() noexcept { return std::span(code, static_cast(sizecode)); } - inline std::span getCodeSpan() const noexcept { + std::span getCodeSpan() const noexcept { return std::span(code, static_cast(sizecode)); } - inline std::span getConstantsSpan() noexcept { + std::span getConstantsSpan() noexcept { return std::span(k, static_cast(sizek)); } - inline std::span getConstantsSpan() const noexcept { + std::span getConstantsSpan() const noexcept { return std::span(k, static_cast(sizek)); } - inline std::span getProtosSpan() noexcept { + std::span getProtosSpan() noexcept { return std::span(p, static_cast(sizep)); } - inline std::span getProtosSpan() const noexcept { + std::span getProtosSpan() const noexcept { return std::span(p, static_cast(sizep)); } - inline std::span getUpvaluesSpan() noexcept { + std::span getUpvaluesSpan() noexcept { return std::span(upvalues, static_cast(sizeupvalues)); } - inline std::span getUpvaluesSpan() const noexcept { + std::span getUpvaluesSpan() const noexcept { return std::span(upvalues, static_cast(sizeupvalues)); } - inline Proto** getProtos() const noexcept { return p; } - inline Upvaldesc* getUpvalues() const noexcept { return upvalues; } - inline GCObject* getGclist() const noexcept { return gclist; } + Proto** getProtos() const noexcept { return p; } + Upvaldesc* getUpvalues() const noexcept { return upvalues; } + GCObject* getGclist() const noexcept { return gclist; } /* Delegating accessors for ProtoDebugInfo */ - inline int getLineInfoSize() const noexcept { return debugInfo.getLineInfoSize(); } - inline int getLocVarsSize() const noexcept { return debugInfo.getLocVarsSize(); } - inline int getAbsLineInfoSize() const noexcept { return debugInfo.getAbsLineInfoSize(); } - inline int getLineDefined() const noexcept { return debugInfo.getLineDefined(); } - inline int getLastLineDefined() const noexcept { return debugInfo.getLastLineDefined(); } - inline TString* getSource() const noexcept { return debugInfo.getSource(); } - inline ls_byte* getLineInfo() const noexcept { return debugInfo.getLineInfo(); } - inline AbsLineInfo* getAbsLineInfo() const noexcept { return debugInfo.getAbsLineInfo(); } - inline LocVar* getLocVars() const noexcept { return debugInfo.getLocVars(); } + int getLineInfoSize() const noexcept { return debugInfo.getLineInfoSize(); } + int getLocVarsSize() const noexcept { return debugInfo.getLocVarsSize(); } + int getAbsLineInfoSize() const noexcept { return debugInfo.getAbsLineInfoSize(); } + int getLineDefined() const noexcept { return debugInfo.getLineDefined(); } + int getLastLineDefined() const noexcept { return debugInfo.getLastLineDefined(); } + TString* getSource() const noexcept { return debugInfo.getSource(); } + ls_byte* getLineInfo() const noexcept { return debugInfo.getLineInfo(); } + AbsLineInfo* getAbsLineInfo() const noexcept { return debugInfo.getAbsLineInfo(); } + LocVar* getLocVars() const noexcept { return debugInfo.getLocVars(); } /* Runtime data setters */ - inline void setNumParams(lu_byte n) noexcept { numparams = n; } - inline void setFlag(lu_byte f) noexcept { flag = f; } - inline void setMaxStackSize(lu_byte s) noexcept { maxstacksize = s; } - inline void setCodeSize(int s) noexcept { sizecode = s; } - inline void setConstantsSize(int s) noexcept { sizek = s; } - inline void setUpvaluesSize(int s) noexcept { sizeupvalues = s; } - inline void setProtosSize(int s) noexcept { sizep = s; } - inline void setCode(Instruction* c) noexcept { code = c; } - inline void setConstants(TValue* constants) noexcept { k = constants; } - inline void setProtos(Proto** protos) noexcept { p = protos; } - inline void setUpvalues(Upvaldesc* uv) noexcept { upvalues = uv; } - inline void setGclist(GCObject* gc) noexcept { gclist = gc; } + void setNumParams(lu_byte n) noexcept { numparams = n; } + void setFlag(lu_byte f) noexcept { flag = f; } + void setMaxStackSize(lu_byte s) noexcept { maxstacksize = s; } + void setCodeSize(int s) noexcept { sizecode = s; } + void setConstantsSize(int s) noexcept { sizek = s; } + void setUpvaluesSize(int s) noexcept { sizeupvalues = s; } + void setProtosSize(int s) noexcept { sizep = s; } + void setCode(Instruction* c) noexcept { code = c; } + void setConstants(TValue* constants) noexcept { k = constants; } + void setProtos(Proto** protos) noexcept { p = protos; } + void setUpvalues(Upvaldesc* uv) noexcept { upvalues = uv; } + void setGclist(GCObject* gc) noexcept { gclist = gc; } /* Delegating setters for ProtoDebugInfo */ - inline void setLineInfoSize(int s) noexcept { debugInfo.setLineInfoSize(s); } - inline void setLocVarsSize(int s) noexcept { debugInfo.setLocVarsSize(s); } - inline void setAbsLineInfoSize(int s) noexcept { debugInfo.setAbsLineInfoSize(s); } - inline void setLineDefined(int l) noexcept { debugInfo.setLineDefined(l); } - inline void setLastLineDefined(int l) noexcept { debugInfo.setLastLineDefined(l); } - inline void setSource(TString* s) noexcept { debugInfo.setSource(s); } - inline void setLineInfo(ls_byte* li) noexcept { debugInfo.setLineInfo(li); } - inline void setAbsLineInfo(AbsLineInfo* ali) noexcept { debugInfo.setAbsLineInfo(ali); } - inline void setLocVars(LocVar* lv) noexcept { debugInfo.setLocVars(lv); } + void setLineInfoSize(int s) noexcept { debugInfo.setLineInfoSize(s); } + void setLocVarsSize(int s) noexcept { debugInfo.setLocVarsSize(s); } + void setAbsLineInfoSize(int s) noexcept { debugInfo.setAbsLineInfoSize(s); } + void setLineDefined(int l) noexcept { debugInfo.setLineDefined(l); } + void setLastLineDefined(int l) noexcept { debugInfo.setLastLineDefined(l); } + void setSource(TString* s) noexcept { debugInfo.setSource(s); } + void setLineInfo(ls_byte* li) noexcept { debugInfo.setLineInfo(li); } + void setAbsLineInfo(AbsLineInfo* ali) noexcept { debugInfo.setAbsLineInfo(ali); } + void setLocVars(LocVar* lv) noexcept { debugInfo.setLocVars(lv); } /* Pointer accessors for serialization and GC */ - inline TString** getSourcePtr() noexcept { return debugInfo.getSourcePtr(); } - inline GCObject** getGclistPtr() noexcept { return &gclist; } + TString** getSourcePtr() noexcept { return debugInfo.getSourcePtr(); } + GCObject** getGclistPtr() noexcept { return &gclist; } /* Runtime data reference accessors for luaM_growvector */ - inline int& getCodeSizeRef() noexcept { return sizecode; } - inline int& getConstantsSizeRef() noexcept { return sizek; } - inline int& getUpvaluesSizeRef() noexcept { return sizeupvalues; } - inline int& getProtosSizeRef() noexcept { return sizep; } + int& getCodeSizeRef() noexcept { return sizecode; } + int& getConstantsSizeRef() noexcept { return sizek; } + int& getUpvaluesSizeRef() noexcept { return sizeupvalues; } + int& getProtosSizeRef() noexcept { return sizep; } - inline Instruction*& getCodeRef() noexcept { return code; } - inline TValue*& getConstantsRef() noexcept { return k; } - inline Proto**& getProtosRef() noexcept { return p; } - inline Upvaldesc*& getUpvaluesRef() noexcept { return upvalues; } + Instruction*& getCodeRef() noexcept { return code; } + TValue*& getConstantsRef() noexcept { return k; } + Proto**& getProtosRef() noexcept { return p; } + Upvaldesc*& getUpvaluesRef() noexcept { return upvalues; } /* Delegating reference accessors for ProtoDebugInfo */ - inline int& getLineInfoSizeRef() noexcept { return debugInfo.getLineInfoSizeRef(); } - inline int& getLocVarsSizeRef() noexcept { return debugInfo.getLocVarsSizeRef(); } - inline int& getAbsLineInfoSizeRef() noexcept { return debugInfo.getAbsLineInfoSizeRef(); } - inline ls_byte*& getLineInfoRef() noexcept { return debugInfo.getLineInfoRef(); } - inline AbsLineInfo*& getAbsLineInfoRef() noexcept { return debugInfo.getAbsLineInfoRef(); } - inline LocVar*& getLocVarsRef() noexcept { return debugInfo.getLocVarsRef(); } + int& getLineInfoSizeRef() noexcept { return debugInfo.getLineInfoSizeRef(); } + int& getLocVarsSizeRef() noexcept { return debugInfo.getLocVarsSizeRef(); } + int& getAbsLineInfoSizeRef() noexcept { return debugInfo.getAbsLineInfoSizeRef(); } + ls_byte*& getLineInfoRef() noexcept { return debugInfo.getLineInfoRef(); } + AbsLineInfo*& getAbsLineInfoRef() noexcept { return debugInfo.getAbsLineInfoRef(); } + LocVar*& getLocVarsRef() noexcept { return debugInfo.getLocVarsRef(); } // Phase 44.5: Additional Proto helper methods diff --git a/src/objects/ltable.h b/src/objects/ltable.h index 9387ba45..3a18fb1c 100644 --- a/src/objects/ltable.h +++ b/src/objects/ltable.h @@ -62,84 +62,84 @@ class Node { : u{val, val_tt, key_tt, next_val, key_val} {} // Copy assignment operator (needed because union contains TValue with user-declared operator=) - inline Node& operator=(const Node& other) noexcept { + Node& operator=(const Node& other) noexcept { u = other.u; // Copy the union return *this; } // Value access - inline TValue* getValue() noexcept { return &i_val; } - inline const TValue* getValue() const noexcept { return &i_val; } + TValue* getValue() noexcept { return &i_val; } + const TValue* getValue() const noexcept { return &i_val; } // Next chain access - inline int& getNext() noexcept { return u.next; } - inline int getNext() const noexcept { return u.next; } - inline void setNext(int n) noexcept { u.next = n; } + int& getNext() noexcept { return u.next; } + int getNext() const noexcept { return u.next; } + void setNext(int n) noexcept { u.next = n; } // Key type access - inline lu_byte getKeyType() const noexcept { return u.key_tt; } - inline void setKeyType(lu_byte tt) noexcept { u.key_tt = tt; } + lu_byte getKeyType() const noexcept { return u.key_tt; } + void setKeyType(lu_byte tt) noexcept { u.key_tt = tt; } // Key value access - inline const Value& getKeyValue() const noexcept { return u.key_val; } - inline Value& getKeyValue() noexcept { return u.key_val; } - inline void setKeyValue(const Value& v) noexcept { u.key_val = v; } + const Value& getKeyValue() const noexcept { return u.key_val; } + Value& getKeyValue() noexcept { return u.key_val; } + void setKeyValue(const Value& v) noexcept { u.key_val = v; } // Key type checks - inline bool isKeyNil() const noexcept { + bool isKeyNil() const noexcept { return u.key_tt == LUA_TNIL; } - inline bool isKeyInteger() const noexcept { + bool isKeyInteger() const noexcept { return u.key_tt == LUA_VNUMINT; } - inline bool isKeyShrStr() const noexcept { + bool isKeyShrStr() const noexcept { return u.key_tt == ctb(LUA_VSHRSTR); } - inline bool isKeyDead() const noexcept { + bool isKeyDead() const noexcept { return u.key_tt == LUA_TDEADKEY; } - inline bool isKeyCollectable() const noexcept { + bool isKeyCollectable() const noexcept { return (u.key_tt & BIT_ISCOLLECTABLE) != 0; } // Key value getters (typed) - inline lua_Integer getKeyIntValue() const noexcept { + lua_Integer getKeyIntValue() const noexcept { return u.key_val.i; } - inline TString* getKeyStrValue() const noexcept { + TString* getKeyStrValue() const noexcept { return reinterpret_cast(u.key_val.gc); } - inline GCObject* getKeyGC() const noexcept { + GCObject* getKeyGC() const noexcept { return u.key_val.gc; } - inline GCObject* getKeyGCOrNull() const noexcept { + GCObject* getKeyGCOrNull() const noexcept { return isKeyCollectable() ? u.key_val.gc : nullptr; } // Key setters - inline void setKeyNil() noexcept { + void setKeyNil() noexcept { u.key_tt = LUA_TNIL; } - inline void setKeyDead() noexcept { + void setKeyDead() noexcept { u.key_tt = LUA_TDEADKEY; } // Copy TValue to key - inline void setKey(const TValue* obj) noexcept { + void setKey(const TValue* obj) noexcept { u.key_val = obj->getValue(); u.key_tt = obj->getType(); } // Copy key to TValue - inline void getKey(lua_State* L, TValue* obj) const noexcept { + void getKey(lua_State* L, TValue* obj) const noexcept { obj->valueField() = u.key_val; obj->setType(u.key_tt); (void)L; // checkliveness removed to avoid forward declaration issues @@ -233,35 +233,35 @@ class Table : public GCBase { // invalidateTMCache uses maskflags from ltm.h, so can't inline here - use macro instead // Phase 44.1: Additional table helper methods - inline unsigned int allocatedNodeSize() const noexcept { + unsigned int allocatedNodeSize() const noexcept { return isDummy() ? 0 : nodeSize(); } - inline unsigned int* getLenHint() noexcept { + unsigned int* getLenHint() noexcept { return static_cast(static_cast(array)); } - inline const unsigned int* getLenHint() const noexcept { + const unsigned int* getLenHint() const noexcept { return static_cast(static_cast(array)); } - inline lu_byte* getArrayTag(lua_Unsigned k) noexcept { + lu_byte* getArrayTag(lua_Unsigned k) noexcept { return static_cast(static_cast(array)) + sizeof(unsigned) + k; } - inline const lu_byte* getArrayTag(lua_Unsigned k) const noexcept { + const lu_byte* getArrayTag(lua_Unsigned k) const noexcept { return static_cast(static_cast(array)) + sizeof(unsigned) + k; } - inline Value* getArrayVal(lua_Unsigned k) noexcept { + Value* getArrayVal(lua_Unsigned k) noexcept { return array - 1 - k; } - inline const Value* getArrayVal(lua_Unsigned k) const noexcept { + const Value* getArrayVal(lua_Unsigned k) const noexcept { return array - 1 - k; } - static inline unsigned int powerOfTwo(unsigned int x) noexcept { + static unsigned int powerOfTwo(unsigned int x) noexcept { return (1u << x); }