Skip to content

Speed up class_getImageName #37913

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

tbkka
Copy link
Contributor

@tbkka tbkka commented Jun 15, 2021

When building for Apple OS, dyld_image_path_containing_address
is much, much faster than dladdr.

Resolves rdar://42137685
Resolves SR-14759

When building for Apple OS, dyld_image_path_containing_address
is much, much faster than dladdr.

Resolves rdar://42137685
Resolves SR-14759
@tbkka tbkka requested review from mikeash and allevato June 15, 2021 01:36
@tbkka
Copy link
Contributor Author

tbkka commented Jun 15, 2021

@swift-ci Please test

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Out of curiosity, do the CI presets use a configuration that builds the core libraries for in-the-OS distribution, so that mach-o/dyld_priv.h is available and the new code path gets utilized?

@mikeash
Copy link
Contributor

mikeash commented Jun 15, 2021

Alas no, CI builds against the public SDK and so it won't see dyld_priv.h. Might be worth bringing our own declaration so that we can use the same code path in CI for more accurate testing.

@tbkka
Copy link
Contributor Author

tbkka commented Jun 15, 2021

I thought we specifically wanted to avoid any non-public calls unless building for in-the-OS distribution?

@mikeash
Copy link
Contributor

mikeash commented Jun 15, 2021

We have quite a few others already. The main thing is just to make sure we can support building with older SDKs (not sure how far back we actually intend to support, but often we're supporting the previous year when calls show up) which is why we look up a lot of stuff dynamically. This call is pretty old so that's not a concern.

@mikeash
Copy link
Contributor

mikeash commented Jun 15, 2021

I should say, building with older SDKs and running on slightly older OSes. We still support development on macOS 11 currently, so the runtimes built by developers still need to work on macOS 11. But still not an issue here.

@tbkka tbkka merged commit c0ccec3 into swiftlang:main Jun 15, 2021
@tbkka tbkka deleted the tbkka/sr14759-class_getImageName-performance branch August 1, 2024 16:37
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.

3 participants