Skip to content

Treat swift_willThrow(Typed) as not locking or performing allocation #77780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 22, 2024

Conversation

DougGregor
Copy link
Member

Prior to throwing, Swift emits a call to swift_willThrow(Typed), which allows various diagnostic tools (such as debuggers and testing libraries) to intercept errors at the point where they are initially thrown.

Since swift_willThrow(Typed) can be hooked by arbitrary code at runtime, there is no way for it to meet performance constraints like @_noLocks or @_noAllocation. Therefore, in a function that has those performance constraints specified, disable emission of the call to swift_willThrow(Typed).

Fixes rdar://140230684.

Prior to throwing, Swift emits a call to `swift_willThrow(Typed)`,
which allows various diagnostic tools (such as debuggers and testing
libraries) to intercept errors at the point where they are initially
thrown.

Since `swift_willThrow(Typed)` can be hooked by arbitrary code at
runtime, there is no way for it to meet performance constraints like
@_noLocks or @_noAllocation. Therefore, in a function that has those
performance constraints specified, disable emission of the call to
`swift_willThrow(Typed)`.

Fixes rdar://140230684.
@DougGregor DougGregor requested review from eeckstein and a team as code owners November 21, 2024 18:20
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor requested a review from jckarter as a code owner November 21, 2024 20:40
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit 657adcb into swiftlang:main Nov 22, 2024
3 checks passed
@DougGregor DougGregor deleted the willthrow-no-locks branch November 22, 2024 17:09
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