-
Notifications
You must be signed in to change notification settings - Fork 103
Add support for capturing backtraces from typed throws. #642
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Conversation
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
@swift-ci please test |
@swift-ci test |
Checking up on the status of swiftlang/swift#62985. |
Yup. Windows is still cranky about weak referencing existential boxes. |
@swift-ci test |
1 similar comment
@swift-ci test |
d7a25a7
to
8133bd7
Compare
@swift-ci test |
8133bd7
to
c8cbbf0
Compare
Swift 6 introduces the typed throws feature to replace `rethrows` and to support error handling in Embedded Swift. This feature uses an ABI that differs from the one used by untyped (traditional) `throws` and as such, our hook into the runtime (`_swift_willThrows`) is insufficient to provide backtrace information for errors thrown this way. This PR adds support for capturing said backtraces _if and only if_ the thrown error is of reference type. Such errors have stable addresses that we can track over time, whereas errors of value type will be copied when used with typed throws.
c8cbbf0
to
15ce720
Compare
@swift-ci test |
briancroom
approved these changes
Sep 4, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# 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.
Swift 6 introduces the typed throws feature to replace
rethrows
and to support error handling in Embedded Swift. This feature uses an ABI that differs from the one used by untyped (traditional)throws
and as such, our hook into the runtime (_swift_willThrow
) is insufficient to provide backtrace information for errors thrown this way.This PR adds support for capturing said backtraces if and only if the thrown error is of reference type. Such errors have stable addresses that we can track over time, whereas errors of value type will be copied when used with typed throws.
I'm also taking the opportunity to implement some performance enhancements toThis PR is dependent on #647.Backtrace
. It shouldn't get called very frequently, but it also should be fast!Checklist: