Skip to content

Commit

Permalink
Final batch of GC cleanups (for the forseeable future).
Browse files Browse the repository at this point in the history
  • Loading branch information
rfm committed Jul 25, 2024
1 parent b49af95 commit 28a6e6e
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 43 deletions.
37 changes: 37 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
2024-07-25 Richard Frith-Macdonald <[email protected]>

* Headers/Foundation/NSHashTable.h:
* Headers/Foundation/NSMapTable.h:
* Headers/Foundation/NSPointerArray.h:
* Headers/Foundation/NSPointerFunctions.h:
* Headers/Foundation/NSZone.h:
* Headers/GNUstepBase/config.h.in:
* Source/GSSocketStream.m:
* Source/GSStream.m:
* Source/NSConcreteHashTable.m:
* Source/NSConcreteMapTable.m:
* Source/NSConcretePointerFunctions.h:
* Source/NSConcretePointerFunctions.m:
* Source/NSConnection.m:
* Source/NSHashTable.m:
* Source/NSKeyedArchiver.m:
* Source/NSKeyedUnarchiver.m:
* Source/NSKeyValueObserving.m:
* Source/NSMapTable.m:
* Source/NSPointerArray.m:
* Source/NSPort.m:
* Source/NSZone.m:
* Tests/base/NSHashTable/create.m:
* Tests/base/NSHashTable/weakObjects.m:
* Tests/base/NSIndexSet/enumerateRanges.m:
* Tests/base/NSMapTable/create.m:
* Tests/base/NSMapTable/weakObjects.m:
* Tests/base/NSPointerArray/weakObjects.m:
* Tests/base/NSPointerFunctions/basic.m:
* Tests/base/NSPointerFunctions/general.m:
* Tests/base/NSPointerFunctions/TestInfo:
General fixups for pointer functions, removing obsolete (non-working)
GC related internal code. There is probably still a little of that old
stuff lurking in the internals which should be removed when found, but
the vast majority is cleaned up.

2024-07-15 Richard Frith-Macdonald <[email protected]>

* Headers/Foundation/NSPointerFunctions.h: deprecate GC methods.
Expand Down
8 changes: 2 additions & 6 deletions Headers/Foundation/NSHashTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,12 @@ GS_EXPORT_CLASS

+ (instancetype) hashTableWithOptions: (NSPointerFunctionsOptions)options;

+ (instancetype) hashTableWithWeakObjects;
/**
* Creates a hash table that uses zeroing weak references (either using the
* automatic reference counting or garbage collection mechanism, depending on
* which mode this framework is compiled in) so that objects are removed when
/** Creates a hash table that uses weak references (using the automatic
* reference counting mechanism) so that objects are removed when
* their last other reference disappears.
*/
+ (instancetype) weakObjectsHashTable;


- (instancetype) initWithOptions: (NSPointerFunctionsOptions)options
capacity: (NSUInteger)initialCapacity;

Expand Down
20 changes: 0 additions & 20 deletions Headers/Foundation/NSMapTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,6 @@ GS_EXPORT_CLASS
+ (instancetype) mapTableWithKeyOptions: (NSPointerFunctionsOptions)keyOptions
valueOptions: (NSPointerFunctionsOptions)valueOptions;

/** Convenience method for creating a map table to store object values
* using object keys.
*/
+ (instancetype) mapTableWithStrongToStrongObjects;

/** Convenience method for creating a map table to store non-retained
* object values with retained object keys.
*/
+ (instancetype) mapTableWithStrongToWeakObjects;

/** Convenience method for creating a map table to store retained
* object values with non-retained object keys.
*/
+ (instancetype) mapTableWithWeakToStrongObjects;

/** Convenience method for creating a map table to store non-retained
* object values with non-retained object keys.
*/
+ (instancetype) mapTableWithWeakToWeakObjects;

/** Convenience method for creating a map table to store object values
* using object keys. The collection will retain both the key and the value.
*/
Expand Down
2 changes: 1 addition & 1 deletion Headers/Foundation/NSPointerArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GS_EXPORT_CLASS
* objects.
*/
+ (id) strongObjectsPointerArray;
/** Returns a new pointer array for storing zeroing weak references to objects.
/** Returns a new pointer array for storing weak references to objects.
*/
+ (id) weakObjectsPointerArray;

Expand Down
5 changes: 3 additions & 2 deletions Source/NSHashTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ + (id) hashTableWithOptions: (NSPointerFunctionsOptions)options

+ (id) hashTableWithWeakObjects
{
return [self hashTableWithOptions:
NSPointerFunctionsObjectPersonality | NSPointerFunctionsWeakMemory];
GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +weakObjectsHashTable");
return [self weakObjectsHashTable];
}

+ (id) weakObjectsHashTable
Expand Down
24 changes: 12 additions & 12 deletions Source/NSMapTable.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,30 @@ + (id) mapTableWithKeyOptions: (NSPointerFunctionsOptions)keyOptions

+ (id) mapTableWithStrongToStrongObjects
{
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality
valueOptions: NSPointerFunctionsObjectPersonality];
GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +strongToStrongObjectsMapTable");
return [self strongToStrongObjectsMapTable];
}

+ (id) mapTableWithStrongToWeakObjects
{
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality
valueOptions: NSPointerFunctionsObjectPersonality
| NSPointerFunctionsWeakMemory];
GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +strongToWeakObjectsMapTable");
return [self strongToWeakObjectsMapTable];
}

+ (id) mapTableWithWeakToStrongObjects
{
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality
| NSPointerFunctionsWeakMemory
valueOptions: NSPointerFunctionsObjectPersonality];
GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +weakToStringObjectsMapTable");
return [self weakToStringObjectsMapTable];
}

+ (id) mapTableWithWeakToWeakObjects
{
return [self mapTableWithKeyOptions: NSPointerFunctionsObjectPersonality
| NSPointerFunctionsWeakMemory
valueOptions: NSPointerFunctionsObjectPersonality
| NSPointerFunctionsWeakMemory];
GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +weakToWeakObjectsMapTable");
return [self weakToWeakObjectsMapTable];
}

+ (id) strongToStrongObjectsMapTable
Expand Down
8 changes: 6 additions & 2 deletions Source/NSPointerArray.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,16 @@ @implementation NSPointerArray (NSArrayConveniences)

+ (id) pointerArrayWithStrongObjects
{
return [self pointerArrayWithOptions: NSPointerFunctionsStrongMemory];
GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +strongObjectsPointerArray");
return [self strongObjectsPointerArray];
}

+ (id) pointerArrayWithWeakObjects
{
return [self pointerArrayWithOptions: NSPointerFunctionsWeakMemory];
GSOnceMLog(@"Garbage Collection no longer supported."
@" Using +weakObjectsPointerArray");
return [self weakObjectsPointerArray];
}

- (NSArray*) allObjects
Expand Down

0 comments on commit 28a6e6e

Please sign in to comment.