Skip to content
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

[6.1] Treat swift_willThrow(Typed) as not locking or performing allocation #77811

Open
wants to merge 3 commits into
base: release/6.1
Choose a base branch
from

Conversation

DougGregor
Copy link
Member

  • Description: The @_noLocks/@_noAllocationchecking considers throwing a typed error to always use generic metadata, even though it is designed not to unless specifically hooked (by a debugger). Teach the checker to allow typed errors in@_noLocks/@_noAllocation mode.
  • Origination: With the introduction of typed throws, we failed to account for this checking pass.
  • Risk: Low.
  • Tested: New tests.
  • Main pull request: Treat swift_willThrow(Typed) as not locking or performing allocation #77780
  • Radar: rdar://140230684
  • Reviewed by: Erik Eckstein

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.

(cherry picked from commit eff9bac)
@DougGregor DougGregor requested a review from a team as a code owner November 22, 2024 18:23
@DougGregor
Copy link
Member Author

@swift-ci please test

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