Preliminary code for emulation of the objc2 runtime weak reference feature

This commit is contained in:
rfm 2024-12-23 18:32:23 +00:00
parent 950e2a5f07
commit c66bd6ec5c
11 changed files with 472 additions and 81 deletions

View file

@ -493,9 +493,7 @@ static BOOL objc_release_fast_no_destroy_internal(id anObject)
* have been greater than zero)
*/
(((obj)anObject)[-1].retained) = 0;
# ifdef OBJC_CAP_ARC
objc_delete_weak_refs(anObject);
# endif
return YES;
}
#else /* GSATOMICREAD */
@ -504,9 +502,7 @@ static BOOL objc_release_fast_no_destroy_internal(id anObject)
pthread_mutex_lock(theLock);
if (((obj)anObject)[-1].retained == 0)
{
# ifdef OBJC_CAP_ARC
objc_delete_weak_refs(anObject);
# endif
pthread_mutex_unlock(theLock);
return YES;
}
@ -947,6 +943,8 @@ static id gs_weak_load(id obj)
{
#ifdef OBJC_CAP_ARC
_objc_weak_load = gs_weak_load;
#else
GSWeakInit();
#endif
objc_create_block_classes_as_subclasses_of(self);
}