-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Runtime] Let CF provide us with state, avoiding runtime lookup. rdar://111104451 #66606
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
Conversation
…her than us having to look it up at runtime
@swift-ci please smoke test |
@swift-ci please smoke test |
@swift-ci please smoke test |
@swift-ci please test |
@swift-ci please benchmark |
@swift-ci please test |
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please test |
ok! Tests green. Mike noticed a few things to tweak, so retesting with those now. |
@swift-ci please test |
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it :-)
static inline void initializeBridgingFunctions() { | ||
swift_once(&initializeBridgingFuncsOnce, | ||
static inline bool initializeBridgingFunctions() { | ||
swift_once(&initializeBridgingStateOnce, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: In runtime code you can use swift::once
as well; the latter has a slightly nicer interface (the context argument is optional and defaults to nullptr
, and swift::once
also supports arbitrary C++ callables, so lambdas and things will work with it). swift_once
is the ABI stable entry point for the compiler to generate calls to.
@@ -87,22 +87,6 @@ swift_stdlib_NSObject_isEqual(id lhs, | |||
return (lhs == rhs) || [lhs isEqual:rhs]; | |||
} | |||
|
|||
SWIFT_CC(swift) SWIFT_RUNTIME_STDLIB_SPI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, getting rid of that is really nice :-) That halves the number of class lookup-by-string calls we're doing.
BTW, I tweaked the description of the PR a little; the only thing missing is a Radar number :-) Really nice change. |
…p. rdar://111104451 (swiftlang#66606)
We can avoid a bunch of calls to
objc_lookUpClass()
if we have CF pass in the information we need, which it already knows.Fixes rdar://111104451