Skip to content

Commit 285f59d

Browse files
committed
Phase 116: std::span Integration - Dyndata accessors
Added std::span accessors to Dyndata class for improved type safety and modern C++ idioms. Changes: - Added Dyndata::actvarGetSpan() methods (const and non-const overloads) - Returns std::span<Vardesc> for the actvar array - Complements existing pointer-based accessors Context: - Phase 112 already added Proto span accessors (code, constants, protos, upvalues) - Phase 115.1 added std::span to buffer/string operations - Phase 115.3 added Table::getArraySpan() - Phase 116 completes span integration for compiler data structures Performance Results: - Baseline: 4.20s avg - Current: 4.18s avg (5-run benchmark) - Change: -0.5% (maintained) - Target: ≤4.33s ✅ PASS Benefits: - Zero-cost abstraction - Better type safety (no raw pointer arithmetic) - Enables range-based algorithms - Modern C++23 idioms All tests passing with "final OK !!!"
1 parent b4772ca commit 285f59d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/compiler/lparser.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef lparser_h
88
#define lparser_h
99

10+
#include <span>
1011
#include "llimits.h"
1112
#include "lobject.h"
1213
#include "lopcodes.h"
@@ -277,6 +278,14 @@ class Dyndata {
277278
return &actvar_vec.back();
278279
}
279280

281+
/* Phase 116: std::span accessors for actvar array */
282+
inline std::span<Vardesc> actvarGetSpan() noexcept {
283+
return std::span(actvar_vec.data(), actvar_vec.size());
284+
}
285+
inline std::span<const Vardesc> actvarGetSpan() const noexcept {
286+
return std::span(actvar_vec.data(), actvar_vec.size());
287+
}
288+
280289
/* Legacy accessor interface for backward compatibility */
281290
class ActvarAccessor {
282291
private:

0 commit comments

Comments
 (0)