Skip to content

Update fast dealloc to match libobjc #29445

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
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions include/swift/Runtime/HeapObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -1120,13 +1120,9 @@ swift_getTypeName(const Metadata *type, bool qualified);
auto heapObj = reinterpret_cast<HeapObject *>(self); \
heapObj->refCounts.setPureSwiftDeallocation(false); \
} \
- (bool)_setAssociatedObject:(id)obj \
forKey:(const void *)key \
associationPolicy:(objc_AssociationPolicy)policy { \
- (void)_noteAssociatedObjects { \
auto heapObj = reinterpret_cast<HeapObject *>(self); \
heapObj->refCounts.setPureSwiftDeallocation(false); \
/* false to let libobjc know it still needs to associate the object */ \
return false; \
} \
- (void)dealloc { \
swift_rootObjCDealloc(reinterpret_cast<HeapObject *>(self)); \
Expand Down
4 changes: 1 addition & 3 deletions stdlib/public/runtime/HeapObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,7 @@ void swift::swift_rootObjCDealloc(HeapObject *self) {

#if SWIFT_OBJC_INTEROP
static bool _check_fast_dealloc() {
//This will always be in libobjc, so RTLD_DEFAULT won't have to do an
//expensive search in practice
return dlsym(RTLD_DEFAULT, "_objc_has_weak_formation_callout") != nullptr;
return dlsym(RTLD_NEXT, "_objc_has_weak_formation_callout") != nullptr;
}
#endif

Expand Down