Skip to content

Commit c6a428f

Browse files
committed
Update fast dealloc to match libobjc
1 parent 1c0bdc8 commit c6a428f

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

include/swift/Runtime/HeapObject.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,13 +1120,9 @@ swift_getTypeName(const Metadata *type, bool qualified);
11201120
auto heapObj = reinterpret_cast<HeapObject *>(self); \
11211121
heapObj->refCounts.setPureSwiftDeallocation(false); \
11221122
} \
1123-
- (bool)_setAssociatedObject:(id)obj \
1124-
forKey:(const void *)key \
1125-
associationPolicy:(objc_AssociationPolicy)policy { \
1123+
- (void)_noteAssociatedObjects { \
11261124
auto heapObj = reinterpret_cast<HeapObject *>(self); \
11271125
heapObj->refCounts.setPureSwiftDeallocation(false); \
1128-
/* false to let libobjc know it still needs to associate the object */ \
1129-
return false; \
11301126
} \
11311127
- (void)dealloc { \
11321128
swift_rootObjCDealloc(reinterpret_cast<HeapObject *>(self)); \

stdlib/public/runtime/HeapObject.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,9 +612,7 @@ void swift::swift_rootObjCDealloc(HeapObject *self) {
612612

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

0 commit comments

Comments
 (0)