mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Tweaks related to issue #311
This commit is contained in:
parent
b91ff38636
commit
4629a4e1f6
5 changed files with 30 additions and 21 deletions
|
@ -1,3 +1,12 @@
|
|||
2024-07-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Headers/Foundation/NSPointerFunctions.h: deprecate GC methods.
|
||||
* Source/NSConcreteHashTable.m: add brackets around test.
|
||||
* Source/NSConcreteMapTable.m: correct test for weak value and key.
|
||||
* Source/NSConcretePointerFunctions.m: Obsolete GC code changes ...
|
||||
Raise exception for setter of GC write barriers.
|
||||
Log error for n getter of GC write barriers.
|
||||
|
||||
2024-07-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSString.m: Implement regular expression search in replace
|
||||
|
|
|
@ -139,15 +139,15 @@ GS_EXPORT_CLASS
|
|||
|
||||
- (void) setSizeFunction: (NSUInteger (*)(const void *item))func;
|
||||
|
||||
- (void) setUsesStrongWriteBarrier: (BOOL)flag;
|
||||
- (void) setUsesStrongWriteBarrier: (BOOL)flag GS_DEPRECATED_FUNC;
|
||||
|
||||
- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag;
|
||||
- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag GS_DEPRECATED_FUNC;
|
||||
|
||||
- (NSUInteger (*)(const void *item)) sizeFunction;
|
||||
|
||||
- (BOOL) usesStrongWriteBarrier;
|
||||
- (BOOL) usesStrongWriteBarrier GS_DEPRECATED_FUNC;
|
||||
|
||||
- (BOOL) usesWeakReadAndWriteBarriers;
|
||||
- (BOOL) usesWeakReadAndWriteBarriers GS_DEPRECATED_FUNC;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -77,7 +77,8 @@ typedef GSIMapNode_t *GSIMapNode;
|
|||
#define GSI_MAP_TABLE_S instanceSize
|
||||
|
||||
#define IS_WEAK(M) \
|
||||
memoryType(M->cb.pf.options, NSPointerFunctionsZeroingWeakMemory) || memoryType(M->cb.pf.options, NSPointerFunctionsWeakMemory)
|
||||
(memoryType(M->cb.pf.options, NSPointerFunctionsZeroingWeakMemory) \
|
||||
|| memoryType(M->cb.pf.options, NSPointerFunctionsWeakMemory))
|
||||
#define GSI_MAP_HASH(M, X)\
|
||||
(M->legacy ? M->cb.old.hash(M, X.ptr) \
|
||||
: pointerFunctionsHash(&M->cb.pf, X.ptr))
|
||||
|
|
|
@ -82,9 +82,11 @@ typedef GSIMapNode_t *GSIMapNode;
|
|||
#define GSI_MAP_KTYPES GSUNION_PTR | GSUNION_OBJ
|
||||
#define GSI_MAP_VTYPES GSUNION_PTR | GSUNION_OBJ
|
||||
#define IS_WEAK_KEY(M) \
|
||||
M->cb.pf.k.options & (NSPointerFunctionsZeroingWeakMemory | NSPointerFunctionsWeakMemory)
|
||||
(memoryType(M->cb.pf.k.options, NSPointerFunctionsZeroingWeakMemory) \
|
||||
|| memoryType(M->cb.pf.k.options, NSPointerFunctionsWeakMemory))
|
||||
#define IS_WEAK_VALUE(M) \
|
||||
M->cb.pf.v.options & (NSPointerFunctionsZeroingWeakMemory | NSPointerFunctionsWeakMemory)
|
||||
(memoryType(M->cb.pf.v.options, NSPointerFunctionsZeroingWeakMemory) \
|
||||
|| memoryType(M->cb.pf.v.options, NSPointerFunctionsWeakMemory))
|
||||
#define GSI_MAP_HASH(M, X)\
|
||||
(M->legacy ? M->cb.old.k.hash(M, X.ptr) \
|
||||
: pointerFunctionsHash(&M->cb.pf.k, X.ptr))
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#import "common.h"
|
||||
#import "Foundation/NSException.h"
|
||||
#import "NSConcretePointerFunctions.h"
|
||||
|
||||
static void*
|
||||
|
@ -340,22 +341,14 @@ relinquishRetainedMemory(const void *item,
|
|||
|
||||
- (void) setUsesStrongWriteBarrier: (BOOL)flag
|
||||
{
|
||||
_x.options &=
|
||||
~(NSPointerFunctionsZeroingWeakMemory
|
||||
|NSPointerFunctionsOpaqueMemory
|
||||
|NSPointerFunctionsMallocMemory
|
||||
|NSPointerFunctionsMachVirtualMemory
|
||||
|NSPointerFunctionsWeakMemory);
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Garbage collection no longer supported"];
|
||||
}
|
||||
|
||||
- (void) setUsesWeakReadAndWriteBarriers: (BOOL)flag
|
||||
{
|
||||
_x.options &=
|
||||
~(NSPointerFunctionsOpaqueMemory
|
||||
|NSPointerFunctionsMallocMemory
|
||||
|NSPointerFunctionsMachVirtualMemory
|
||||
|NSPointerFunctionsWeakMemory);
|
||||
_x.options |= NSPointerFunctionsZeroingWeakMemory;
|
||||
[NSException raise: NSGenericException
|
||||
format: @"Garbage collection no longer supported"];
|
||||
}
|
||||
|
||||
- (NSUInteger (*)(const void *item)) sizeFunction
|
||||
|
@ -365,12 +358,16 @@ relinquishRetainedMemory(const void *item,
|
|||
|
||||
- (BOOL) usesStrongWriteBarrier
|
||||
{
|
||||
return memoryType(_x.options, NSPointerFunctionsStrongMemory);
|
||||
NSLog(@"-usesStrongWriteBarrier does nothing:"
|
||||
@" garbage collection not supported");
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) usesWeakReadAndWriteBarriers
|
||||
{
|
||||
return memoryType(_x.options, NSPointerFunctionsZeroingWeakMemory);
|
||||
NSLog(@"-usesWeakReadAndWriteBarriers does nothing:"
|
||||
@" garbage collection not supported");
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue