Replaced IF_NO_GC() macro calls with the more descriptive IF_NO_ARC()

and deprecate it.  Searched for and removed obsolete references to
garbage collection in comments and documentation.
This commit is contained in:
Richard Frith-Macdonald 2022-02-17 10:08:18 +00:00
parent 6837924e60
commit c76ebf2962
61 changed files with 384 additions and 313 deletions

View file

@ -119,18 +119,6 @@ static Class concrete = 0;
@end
/*
* Garbage collection considerations -
* The notification center is not supposed to retain any notification
* observers or notification objects. To achieve this when using garbage
* collection, we must hide all references to observers and objects.
* Within an Observation structure, this is not a problem, we simply
* allocate the structure using 'atomic' allocation to tell the gc
* system to ignore pointers inside it.
* Elsewhere, we store the pointers with a bit added, to hide them from
* the garbage collector.
*/
struct NCTbl; /* Notification Center Table structure */
/*
@ -238,11 +226,6 @@ static void obsFree(Observation *o);
* lists of Observations. This lets us avoid the overhead of creating
* and destroying map tables when we are frequently adding and removing
* notification observations.
*
* Performance is however, not the primary reason for using this
* structure - it provides a neat way to ensure that observers pointed
* to by the Observation structures are not seen as being in use by
* the garbage collection mechanism.
*/
#define CHUNKSIZE 128
#define CACHESIZE 16
@ -273,8 +256,7 @@ obsNew(NCTable *t, SEL s, id o)
/* Generally, observations are cached and we create a 'new' observation
* by retrieving from the cache or by allocating a block of observations
* in one go. This works nicely to both hide observations from the
* garbage collector (when using gcc for GC) and to provide high
* in one go. This works nicely to provide high
* performance for situations where apps add/remove lots of observers
* very frequently (poor design, but something which happens in the
* real world unfortunately).
@ -758,8 +740,6 @@ static NSNotificationCenter *default_center = nil;
* <p>The notification center does not retain observer or object. Therefore,
* you should always send removeObserver: or removeObserver:name:object: to
* the notification center before releasing these objects.<br />
* As a convenience, when built with garbage collection, you do not need to
* remove any garbage collected observer as the system will do it implicitly.
* </p>
*
* <p>NB. For MacOS-X compatibility, adding an observer multiple times will
@ -1097,9 +1077,8 @@ static NSNotificationCenter *default_center = nil;
* Lock the table of observations while we traverse it.
*
* The table of observations contains weak pointers which are zeroed when
* the observers get garbage collected. So to avoid consistency problems
* we disable gc while we copy all the observations we are interested in.
* We use scanned memory in the array in the case where there are more
* the observers get destroyed. So to avoid consistency problems
* we use scanned memory in the array in the case where there are more
* than the 64 observers we allowed room for on the stack.
*/
GSIArrayInitWithZoneAndStaticCapacity(a, _zone, 64, i);