Skip to content

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

Merged
merged 1 commit into from
Jun 19, 2019

Conversation

Catfish-Man
Copy link
Contributor

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

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@Catfish-Man Catfish-Man self-assigned this Jun 13, 2019
Copy link
Contributor Author

@Catfish-Man Catfish-Man left a 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

//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())
Copy link
Contributor Author

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

}

static void _interpose_objc_association(void *ctxt) {
if (__builtin_available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *))) {
Copy link
Contributor Author

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);
Copy link
Contributor Author

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

@Catfish-Man Catfish-Man requested a review from mikeash June 13, 2019 01:43
@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 25fa3bd1dbebf21234598469ed28291289d97c5d

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 25fa3bd1dbebf21234598469ed28291289d97c5d

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 25fa3bd1dbebf21234598469ed28291289d97c5d

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 25fa3bd1dbebf21234598469ed28291289d97c5d

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - f705b7732ce1e780b0f5596cdd308ac05020d78b

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - f705b7732ce1e780b0f5596cdd308ac05020d78b

@Catfish-Man
Copy link
Contributor Author

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.
@Catfish-Man Catfish-Man force-pushed the no-objc-complications-4 branch from 67c7219 to c512946 Compare June 18, 2019 23:17
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test and merge

1 similar comment
@Catfish-Man
Copy link
Contributor Author

@swift-ci please test and merge

@Catfish-Man
Copy link
Contributor Author

I'm told that the linux failures are irregular and were seen this morning, gonna retry

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 67c72191d86b42237f43da633c14b29018f7beff

@Catfish-Man
Copy link
Contributor Author

@swift-ci clean test Linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c512946

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c512946

@Catfish-Man
Copy link
Contributor Author

@swift-ci clean test Linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c512946

@Catfish-Man
Copy link
Contributor Author

@swift-ci please test linux platform

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