Skip to content

Mark generated literal and cache slot accessors noexcept - #105

Open
yavon007 wants to merge 1 commit into
swoole:masterfrom
yavon007:codex/noexcept-generated-accessors
Open

Mark generated literal and cache slot accessors noexcept#105
yavon007 wants to merge 1 commit into
swoole:masterfrom
yavon007:codex/noexcept-generated-accessors

Conversation

@yavon007

Copy link
Copy Markdown
Contributor

Generated literal-string and request-cache slot accessors only index existing
arrays and return references, but their cross-translation-unit declarations
currently allow C++ exceptions. Callers consequently retain exception cleanup
metadata for calls that cannot throw.

Add noexcept consistently to declarations and definitions of get_str,
get_property_cache, typephp_get_method_call_cache, and
typephp_get_function_call_cache. Keep resolving lookups potentially throwing.
Add coverage for the generated declarations and definitions.

Validation: 103 focused PHPUnit tests / 616 assertions, 51 compiled dungeon
behavior assertions matching PHP, and an exception probe covering finally,
previous exception identity, rethrow identity, and invalid throwable handling.
The 11 PHPUnit deprecations also occur on the baseline. Multi-file AOT builds
and output checks pass on Linux ARM64, GCC, PHP 8.5.10 ZTS, PHPX 4b3a472.

In an unchanged exception-heavy dungeon replay, two subsequent alternating
baseline/candidate batches reduce median elapsed time by 4.1% and 4.8%.
Each batch uses one warmup pair and five measured pairs of 20,000 games.
The dungeon translation unit's exception table shrinks from 2,848 to 2,604
bytes; text grows by 196 bytes and unwind-frame data grows by 16 bytes.
These measurements are workload/platform specific, not a general PHP speedup.

Normal-path short measurements vary in both directions. An extended run of
100,000 games per sample is effectively flat: baseline median 2.482272 seconds,
candidate 2.473237 seconds (-0.36%), with overlapping sample ranges. No
normal-path speedup is claimed. An earlier batch under heavy host CPU contention
is retained as inconclusive evidence, not used to substantiate the performance
claim. Windows/macOS and other compiler configurations have not been tested for
this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant