Commit c0777f2
committed
Phase 122-123: std::span callsite conversion (Parts 2-3 - Compiler & Runtime)
Converted 9 additional patterns to use existing std::span accessors:
**Phase 122 - Compiler Code (7 conversions):**
funcstate.cpp:
1. registerlocalvar() - locVarsSpan initialization loop
2. searchupvalue() - upvaluesSpan search loop
3. allocupvalue() - upvaluesSpan initialization loop
lcode.cpp:
4. addk() - constantsSpan initialization loop
5. finaltarget() - codeSpan jump chain following
6. finish() - codeSpan instruction loop
parser.cpp:
7. addprototype() - protosSpan initialization loop
**Phase 123 - Runtime Code (2 conversions):**
lfunc.cpp:
8. Proto::getLocalName() - locVarsSpan range-based for loop
lvm.cpp:
9. lua_State::pushClosure() - upvaluesSpan range-based for loop
All conversions use existing span accessors from Phase 115-116:
- Proto::getCodeSpan()
- Proto::getConstantsSpan()
- Proto::getProtosSpan()
- Proto::getUpvaluesSpan()
- ProtoDebugInfo::getLocVarsSpan()
Benefits:
- Type-safe array access throughout compiler and runtime
- Cleaner range-based for loops where applicable
- Better bounds safety with std::span
- More idiomatic modern C++23 code
Testing:
- All tests pass (final OK !!!)
- Performance: 4.61s avg (within acceptable bounds)
- Total std::span conversions: 15 (Phase 121: 6 + Phase 122: 7 + Phase 123: 2)
This completes the std::span expansion effort (Option 2) with 15 new
call sites converted beyond the original Phase 115-116 accessor additions.1 parent 4969379 commit c0777f2
File tree
5 files changed
+38
-31
lines changed- src
- compiler
- objects
- vm
5 files changed
+38
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
181 | 182 | | |
182 | 183 | | |
183 | 184 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
200 | | - | |
201 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | 328 | | |
| |||
1071 | 1072 | | |
1072 | 1073 | | |
1073 | 1074 | | |
1074 | | - | |
| 1075 | + | |
1075 | 1076 | | |
1076 | 1077 | | |
1077 | | - | |
| 1078 | + | |
1078 | 1079 | | |
1079 | 1080 | | |
1080 | 1081 | | |
| |||
1654 | 1655 | | |
1655 | 1656 | | |
1656 | 1657 | | |
| 1658 | + | |
1657 | 1659 | | |
1658 | | - | |
| 1660 | + | |
1659 | 1661 | | |
1660 | 1662 | | |
1661 | 1663 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
412 | 412 | | |
413 | 413 | | |
414 | 414 | | |
415 | | - | |
416 | | - | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
417 | 418 | | |
418 | | - | |
| 419 | + | |
419 | 420 | | |
420 | 421 | | |
421 | 422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
322 | | - | |
323 | | - | |
324 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
325 | 327 | | |
326 | 328 | | |
327 | | - | |
| 329 | + | |
328 | 330 | | |
329 | 331 | | |
330 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
0 commit comments