-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Use the remaining half bit in the refcount to bypass ObjC deallocation overhead #25418
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
Use the remaining half bit in the refcount to bypass ObjC deallocation overhead #25418
Conversation
@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.
Calling out the few changes since the previous approved patch
stdlib/public/SwiftShims/RefCount.h
Outdated
//Immortal and no objc complications share a bit, so don't let setting | ||
//the complications one clear the immmortal one | ||
if (oldbits.isImmortal(true) || oldbits.pureSwiftDeallocation() == nonobjc){ | ||
assert(!oldbits.hasSideTable()) |
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.
This is new from the previous change, at @jrose-apple's suggestion
stdlib/public/runtime/HeapObject.cpp
Outdated
} | ||
|
||
static void _interpose_objc_association(void *ctxt) { | ||
if (__builtin_available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *))) { |
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.
This is new, and I've verified that it compiles to nothing when targeting the listed OSs, so the in-OS build shouldn't see any overhead from it.
} | ||
|
||
LLVM_ATTRIBUTE_ALWAYS_INLINE | ||
void setIsImmortal(bool value) { | ||
setField(IsImmortal, value); | ||
assert(value); |
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.
This switch only flips one way, so we assert that now
Build failed |
Build failed |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
Build failed |
Build failed |
Need a compiler-rt fix; it's currently only building for Intel in Swift CI |
…ObjC deallocation overhead"" And add availability checking for back deployment This reverts commit 817ea12.
67c7219
to
c512946
Compare
@swift-ci please test and merge |
1 similar comment
@swift-ci please test and merge |
I'm told that the linux failures are irregular and were seen this morning, gonna retry |
@swift-ci please test linux platform |
Build failed |
@swift-ci clean test Linux |
Build failed |
@swift-ci please test linux platform |
Build failed |
@swift-ci clean test Linux |
Build failed |
@swift-ci please test linux platform |
We can use the new setAssociatedObject interposition function to make this safe. 1.1-1.5x win on a huge variety of benchmarks.
#ifdef'd out for platforms that don't have the new interposition function, and guarded with __builtin_available so it'll back-deploy
Fixes rdar://36825362