Skip to content

[6.0][Runtime] Avoid dlsym of objc_isUniquelyReferenced. #73432

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

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented May 3, 2024

Cherry-pick #73285 to release/6.0.

We attempted to use the declaration if it exists, and fall back to dlsym. This didn't actually work and we always call dlsym. Include the right header (when available) and add a weak check to the direct call.

rdar://127116080

We attempted to use the declaration if it exists, and fall back to dlsym. This didn't actually work and we always call dlsym. Include the right header (when available) and add a weak check to the direct call.

rdar://127116080
(cherry picked from commit 4d62c52)
@mikeash mikeash requested a review from a team as a code owner May 3, 2024 21:14
@mikeash
Copy link
Contributor Author

mikeash commented May 3, 2024

Explanation: We want to directly reference objc_isUniquelyReferenced when it's available in the SDK, and look it up with dlsym when it isn't. The previous attempt to do that didn't quite work, and always used dlsym, which imposes a performance penalty on first use..
Original PR: #73285
Reviewed by: @Catfish-Man
Risk: Low. We make the same call, but in the normal way by referencing it from a header, instead of looking it up with dlsym.
Resolves: rdar://127116080
Tests: Many existing tests exercise this code.

@mikeash
Copy link
Contributor Author

mikeash commented May 3, 2024

@swift-ci please test

@mikeash mikeash enabled auto-merge May 3, 2024 21:19
@mikeash mikeash merged commit c1bb375 into swiftlang:release/6.0 May 6, 2024
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.

2 participants