Repository navigation
Allow opting out of the runtime downcast assertion - #2477
Open
ryazwinski wants to merge 1 commit into
Open
ryazwinski wants to merge 1 commit into
ryazwinski wants to merge 1 commit into
Conversation
The runtime downcast check is useful for catching bad type-erasure invariants, but it can dominate CPU time in a hot asynchronous path. For example, OpenBMC's PLDM sensor loop awaits a request per reading, and the erased scheduler and sender exercise this helper on every round trip. Keep the check enabled by default. Let a consumer consistently define STDEXEC_DISABLE_POLYMORPHIC_DOWNCAST_ASSERT for a build that needs to opt out of this one check. Preserve the existing static cast, compile-time constraints, and all other assertions.
Collaborator
|
isn't the |
Author
|
yea it would be.. not sure why it's enabled in Openbmc/pldmd.. lemme do some digging.. will circle back. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The runtime assertion in
__polymorphic_downcastcallsdynamic_castbefore returning thestatic_cast. It is frequently reached by OpenBMC PLDM's type-erased scheduler and sender when polling sensors. On an ARM BMC, the runtime type checks are a measurable cost even when the types are correct.The default is unchanged. An embedding build may define
STDEXEC_DISABLE_POLYMORPHIC_DOWNCAST_ASSERTconsistently for code sharing these inline definitions. It then loses this diagnostic, but keeps the compile-time constraints and every other assertion. This option does not make a downcast valid when the caller violates the existing type invariant.A two-mode ARM compile fixture checked that the default instantiation retains the runtime cast, the opt-in instantiation does not, and an unrelated assertion remains present in both. A Yosemite 4 lab A/B/A with polling unchanged reproduced the CPU improvement, and the full image passed an eight-slot discovery and sensor freshness smoke test.