<exception>: Optimize exception_ptr operations - #6403
Open
nt (namtran1812) wants to merge 3 commits into
Open
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
Author
|
@microsoft-github-policy-service agree |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Author
|
Hi! All CI checks are passing now. When you have a chance, could someone from @microsoft/vclibs take another look? Thanks! |
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.
Summary
Optimizes several
std::exception_ptroperations that currently call out-of-line CRT helpers even though the representation is already known in<exception>.This change:
nullptr_tconstructor rely on the existing null member initializersoperator bool()as_Data1 != nullptr_Data1directly inoperator==_Data1and_Data2directlynullptr_tusing swap-with-empty, avoiding__ExceptionPtrAssignThe exported CRT helper functions remain unchanged for ABI compatibility.
Fixes #6387.
Rationale
exception_ptris intentionally laid out to matchshared_ptr<const _EXCEPTION_RECORD>. Its two data members correspond to the shared pointer's stored pointer and control block, and the implementation already contains astatic_assertenforcing matching size and alignment.The removed out-of-line calls currently perform operations equivalent to the inlined implementations above:
__ExceptionPtrCreatedefault-constructs an emptyshared_ptr__ExceptionPtrToBoolconverts the underlyingshared_ptrtobool__ExceptionPtrComparecompares the underlyingshared_ptr__ExceptionPtrSwapswaps the underlyingshared_ptrFor
operator=(nullptr_t), swapping with an emptyexception_ptrpreserves ownership semantics and allows the temporary's destructor to release the previous control block correctly.Validation
The existing
Dev11_0299014_exception_ptr_requirementstest already exercises the affected semantics, including:nullptrconstructionnullptrNo ABI-visible layout or exported CRT symbol is changed.