Author: mlytwyn Date: Fri Sep 23 21:17:10 2016 New Revision: 40101 URL: http://svn.gna.org/viewcvs/gnustep?rev=40101&view=rev Log: Merge with base trunk revision 40072
Modified: libs/base/branches/gnustep_testplant_branch/Source/NSInvocation.m libs/base/branches/gnustep_testplant_branch/Source/NSKeyValueObserving.m libs/base/branches/gnustep_testplant_branch/Source/NSKeyedArchiver.m libs/base/branches/gnustep_testplant_branch/Source/NSKeyedUnarchiver.m libs/base/branches/gnustep_testplant_branch/Source/NSLocale.m libs/base/branches/gnustep_testplant_branch/Source/NSLog.m libs/base/branches/gnustep_testplant_branch/Source/NSMapTable.m libs/base/branches/gnustep_testplant_branch/Source/NSNotificationCenter.m Modified: libs/base/branches/gnustep_testplant_branch/Source/NSInvocation.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSInvocation.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSInvocation.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSInvocation.m Fri Sep 23 21:17:10 2016 @@ -79,7 +79,7 @@ #if defined(HAVE_MMAP) munmap(buffer, size); #else -#if !defined(__MINGW__) && defined(HAVE_MPROTECT) +#if !defined(_WIN32) && defined(HAVE_MPROTECT) if (mprotect(buffer, NSPageSize(), PROT_READ|PROT_WRITE) == -1) { NSLog(@"Failed to protect memory as writable: %@", [NSError _last]); @@ -159,7 +159,7 @@ - (void) protect { #if !defined(HAVE_FFI_PREP_CLOSURE_LOC) -#if defined(__MINGW__) +#if defined(_WIN32) DWORD old; if (VirtualProtect(buffer, size, PAGE_EXECUTE, &old) == 0) { Modified: libs/base/branches/gnustep_testplant_branch/Source/NSKeyValueObserving.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSKeyValueObserving.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSKeyValueObserving.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSKeyValueObserving.m Fri Sep 23 21:17:10 2016 @@ -992,16 +992,6 @@ @implementation GSKVOObservation -#if GS_WITH_GC -+ (void) initialize -{ - GSMakeWeakPointer(self, "observer"); -} -- (void) finalize -{ - GSAssignZeroingWeakPointer((void**)&observer, nil); -} -#endif @end @implementation GSKVOPathInfo @@ -1165,15 +1155,6 @@ o->options = options; observation = o; } -#if GS_WITH_GC - else if (o->observer == nil) - { - /* The observer for thsi observation must have been collected. - */ - [pathInfo->observations removeObjectAtIndex: count]; - continue; - } -#endif pathInfo->allOptions |= o->options; } if (observation == nil) @@ -1302,16 +1283,8 @@ context = o->context; break; } -#if GS_WITH_GC - else if (o->observer == nil) - { - /* The observer for thsi observation must have been collected. - */ - [pathInfo->observations removeObjectAtIndex: count]; } -#endif } - } [iLock unlock]; return context; } Modified: libs/base/branches/gnustep_testplant_branch/Source/NSKeyedArchiver.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSKeyedArchiver.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSKeyedArchiver.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSKeyedArchiver.m Fri Sep 23 21:17:10 2016 @@ -45,17 +45,8 @@ #define GSI_MAP_HASH(M, X) ((X).nsu) #define GSI_MAP_EQUAL(M, X,Y) ((X).ptr == (Y).ptr) #undef GSI_MAP_NOCLEAN -#if GS_WITH_GC -#include <gc/gc_typed.h> -static GC_descr nodeDesc; // Type descriptor for map node. -#define GSI_MAP_NODES(M, X) \ -(GSIMapNode)GC_calloc_explicitly_typed(X, sizeof(GSIMapNode_t), nodeDesc) -#define GSI_MAP_RETAIN_KEY(M, X) -#define GSI_MAP_RELEASE_KEY(M, X) -#else #define GSI_MAP_RETAIN_KEY(M, X) RETAIN(X.obj) #define GSI_MAP_RELEASE_KEY(M, X) RELEASE(X.obj) -#endif #include "GNUstepBase/GSIMap.h" @@ -488,15 +479,6 @@ + (void) initialize { -#if GS_WITH_GC - /* We create a typed memory descriptor for map nodes. - */ - GC_word w[GC_BITMAP_SIZE(GSIMapNode_t)] = {0}; - GC_set_bit(w, GC_WORD_OFFSET(GSIMapNode_t, key)); - GC_set_bit(w, GC_WORD_OFFSET(GSIMapNode_t, value)); - nodeDesc = GC_make_descriptor(w, GC_WORD_LEN(GSIMapNode_t)); -#endif - GSMakeWeakPointer(self, "delegate"); if (globalClassMap == 0) @@ -871,12 +853,7 @@ /* * Set up map tables. */ -#if GS_WITH_GC - _cIdMap = (GSIMapTable)NSAllocateCollectable(sizeof(GSIMapTable_t)*5, - NSScannedOption); -#else _cIdMap = (GSIMapTable)NSZoneMalloc(zone, sizeof(GSIMapTable_t)*5); -#endif _uIdMap = &_cIdMap[1]; _repMap = &_cIdMap[2]; GSIMapInitWithZoneAndCapacity(_cIdMap, zone, 10); Modified: libs/base/branches/gnustep_testplant_branch/Source/NSKeyedUnarchiver.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSKeyedUnarchiver.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSKeyedUnarchiver.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSKeyedUnarchiver.m Fri Sep 23 21:17:10 2016 @@ -38,13 +38,8 @@ /* * Setup for inline operation of arrays. */ -#if GS_WITH_GC -#define GSI_ARRAY_RETAIN(A, X) -#define GSI_ARRAY_RELEASE(A, X) -#else #define GSI_ARRAY_RETAIN(A, X) [(X).obj retain] #define GSI_ARRAY_RELEASE(A, X) [(X).obj release] -#endif #define GSI_ARRAY_TYPES GSUNION_OBJ @@ -419,13 +414,13 @@ if (strcmp([o type], type) != 0) { [NSException raise: NSInvalidUnarchiveOperationException - format: @"[%@ +%@]: type missmatch for %@", + format: @"[%@ +%@]: type mismatch for %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd), o]; } if ([o count] != expected) { [NSException raise: NSInvalidUnarchiveOperationException - format: @"[%@ +%@]: count missmatch for %@", + format: @"[%@ +%@]: count mismatch for %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd), o]; } NSGetSizeAndAlignment(type, 0, &size); @@ -841,12 +836,7 @@ _objects = [_archive objectForKey: @"$objects"]; _keyMap = [_archive objectForKey: @"$top"]; - -#if GS_WITH_GC - _objMap = NSAllocateCollectable(sizeof(GSIArray_t), NSScannedOption); -#else _objMap = NSZoneMalloc(_zone, sizeof(GSIArray_t)); -#endif count = [_objects count]; GSIArrayInitWithZoneAndCapacity(_objMap, _zone, count); // Add marker for nil object Modified: libs/base/branches/gnustep_testplant_branch/Source/NSLocale.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSLocale.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSLocale.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSLocale.m Fri Sep 23 21:17:10 2016 @@ -588,6 +588,11 @@ return AUTORELEASE(result); } ++ (id) localeWithLocaleIdentifier:(NSString *)string +{ + return AUTORELEASE([[NSLocale alloc] initWithLocaleIdentifier: string]); +} + + (NSString *) localeIdentifierFromComponents: (NSDictionary *) dict { NSString *result; @@ -851,8 +856,9 @@ - (BOOL) isEqual: (id) obj { if ([obj isKindOfClass: [self class]]) + { return [_localeId isEqual: [obj localeIdentifier]]; - + } return NO; } @@ -1052,7 +1058,6 @@ [nFor setLocale: self]; [nFor setNumberStyle: NSNumberFormatterDecimalStyle]; result = [nFor decimalSeparator]; - RELEASE(nFor); return result; } @@ -1066,7 +1071,6 @@ [nFor setLocale: self]; [nFor setNumberStyle: NSNumberFormatterDecimalStyle]; result = [nFor groupingSeparator]; - RELEASE(nFor); return result; } Modified: libs/base/branches/gnustep_testplant_branch/Source/NSLog.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSLog.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSLog.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSLog.m Fri Sep 23 21:17:10 2016 @@ -119,7 +119,7 @@ NSData *d; const char *buf; unsigned len; -#if defined(__MINGW__) +#if defined(_WIN32) LPCWSTR null_terminated_buf; #else #if defined(HAVE_SYSLOG) || defined(HAVE_SLOGF) @@ -150,7 +150,7 @@ len = [d length]; } -#if defined(__MINGW__) +#if defined(_WIN32) null_terminated_buf = UNISTR(message); OutputDebugStringW(null_terminated_buf); @@ -229,7 +229,7 @@ #else write(_NSLogDescriptor, buf, len); #endif -#endif // __MINGW__ +#endif // _WIN32 } /** @@ -345,7 +345,7 @@ if (pid == 0) { -#if defined(__MINGW__) +#if defined(_WIN32) pid = (int)GetCurrentProcessId(); #else pid = (int)getpid(); Modified: libs/base/branches/gnustep_testplant_branch/Source/NSMapTable.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSMapTable.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSMapTable.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSMapTable.m Fri Sep 23 21:17:10 2016 @@ -139,10 +139,8 @@ o = [self initWithKeyPointerFunctions: k valuePointerFunctions: v capacity: initialCapacity]; -#if !GS_WITH_GC [k release]; [v release]; -#endif return o; } Modified: libs/base/branches/gnustep_testplant_branch/Source/NSNotificationCenter.m URL: http://svn.gna.org/viewcvs/gnustep/libs/base/branches/gnustep_testplant_branch/Source/NSNotificationCenter.m?rev=40101&r1=40100&r2=40101&view=diff ============================================================================== --- libs/base/branches/gnustep_testplant_branch/Source/NSNotificationCenter.m (original) +++ libs/base/branches/gnustep_testplant_branch/Source/NSNotificationCenter.m Fri Sep 23 21:17:10 2016 @@ -148,23 +148,6 @@ * trivial class instead ... and gets managed by the garbage collector. */ -#ifdef __OBJC_GC__ - -@interface GSObservation : NSObject -{ - @public - __weak id observer; /* Object to receive message. */ - SEL selector; /* Method selector. */ - struct Obs *next; /* Next item in linked list. */ - struct NCTbl *link; /* Pointer back to chunk table */ -} -@end -@implementation GSObservation -@end -#define Observation GSObservation - -#else - typedef struct Obs { id observer; /* Object to receive message. */ SEL selector; /* Method selector. */ @@ -173,8 +156,6 @@ struct NCTbl *link; /* Pointer back to chunk table */ } Observation; -#endif - #define ENDOBS ((Observation*)-1) static inline NSUInteger doHash(BOOL shouldHash, NSString* key) @@ -214,34 +195,17 @@ */ static void listFree(Observation *list); -#ifdef __OBJC_GC__ - -/* Observations are managed by the GC system because they need to be - * instances of a class in order to implement weak pointer to observer. - */ -#define obsRetain(X) -#define obsFree(X) - -#else - /* Observations have retain/release counts managed explicitly by fast * function calls. */ static void obsRetain(Observation *o); static void obsFree(Observation *o); -#endif - #define GSI_ARRAY_TYPES 0 #define GSI_ARRAY_TYPE Observation* -#ifdef __OBJC_GC__ -#define GSI_ARRAY_NO_RELEASE 1 -#define GSI_ARRAY_NO_RETAIN 1 -#else #define GSI_ARRAY_RELEASE(A, X) obsFree(X.ext) #define GSI_ARRAY_RETAIN(A, X) obsRetain(X.ext) -#endif #include "GNUstepBase/GSIArray.h" @@ -256,13 +220,6 @@ #define GSI_MAP_VTYPES GSUNION_PTR #define GSI_MAP_VEXTRA Observation* #define GSI_MAP_EXTRA BOOL - -#if GS_WITH_GC -#include <gc/gc_typed.h> -static GC_descr nodeDesc; // Type descriptor for map node. -#define GSI_MAP_NODES(M, X) \ -(GSIMapNode)GC_calloc_explicitly_typed(X, sizeof(GSIMapNode_t), nodeDesc) -#endif #include "GNUstepBase/GSIMap.h" @@ -314,22 +271,6 @@ { Observation *obs; -#if __OBJC_GC__ - - /* With clang GC, observations are garbage collected and we don't - * use a cache. However, because the reference to the observer must be - * weak, the observation has to be an instance of a class ... - */ - static Class observationClass; - - if (0 == observationClass) - { - observationClass = [GSObservation class]; - } - obs = NSAllocateObject(observationClass, 0, _zone); - -#else - /* 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 @@ -367,14 +308,9 @@ obs->link = (void*)t; obs->retained = 0; obs->next = 0; -#endif obs->selector = s; -#if GS_WITH_GC - GSAssignZeroingWeakPointer((void**)&obs->observer, (void*)o); -#else obs->observer = o; -#endif return obs; } @@ -504,7 +440,6 @@ [t->_lock unlock]; } -#ifndef __OBJC_GC__ static void obsFree(Observation *o) { NSCAssert(o->retained >= 0, NSInternalInconsistencyException); @@ -512,9 +447,6 @@ { NCTable *t = o->link; -#if GS_WITH_GC - GSAssignZeroingWeakPointer((void**)&o->observer, 0); -#endif o->link = (NCTable*)t->freeList; t->freeList = o; } @@ -524,7 +456,6 @@ { o->retained++; } -#endif static void listFree(Observation *list) { @@ -624,24 +555,8 @@ * purgeCollectedFromMapNode() does the same thing but also handles cleanup * of the map node containing the list if necessary. */ -#if GS_WITH_GC -#define purgeCollected(X) listPurge(X, nil) -static Observation* -purgeCollectedFromMapNode(GSIMapTable map, GSIMapNode node) -{ - Observation *o; - - o = node->value.ext = purgeCollected((Observation*)(node->value.ext)); - if (o == ENDOBS) - { - GSIMapRemoveKey(map, node->key); - } - return o; -} -#else #define purgeCollected(X) (X) #define purgeCollectedFromMapNode(X, Y) ((Observation*)Y->value.ext) -#endif @interface GSNotificationBlockOperation : NSOperation @@ -769,16 +684,7 @@ { if (self == [NSNotificationCenter class]) { -#if GS_WITH_GC - /* We create a typed memory descriptor for map nodes. - */ - GC_word w[GC_BITMAP_SIZE(GSIMapNode_t)] = {0}; - GC_set_bit(w, GC_WORD_OFFSET(GSIMapNode_t, key)); - GC_set_bit(w, GC_WORD_OFFSET(GSIMapNode_t, value)); - nodeDesc = GC_make_descriptor(w, GC_WORD_LEN(GSIMapNode_t)); -#else _zone = NSDefaultMallocZone(); -#endif if (concrete == 0) { concrete = [GSNotification class]; @@ -1178,9 +1084,6 @@ GSIArrayItem i[64]; GSIArray_t b; GSIArray a = &b; -#if GS_WITH_GC - NSGarbageCollector *collector = [NSGarbageCollector defaultCollector]; -#endif if (name == nil) { @@ -1199,12 +1102,7 @@ * 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. */ -#if GS_WITH_GC - GSIArrayInitWithZoneAndStaticCapacity(a, (NSZone*)1, 64, i); - [collector disable]; -#else GSIArrayInitWithZoneAndStaticCapacity(a, _zone, 64, i); -#endif lockNCTable(TABLE); /* @@ -1282,15 +1180,9 @@ } } - /* - * Finished with the table ... we can unlock it and re-enable garbage - * collection, safe in the knowledge that the observers we will be - * notifying won't get collected prematurely. + /* Finished with the table ... we can unlock it, */ unlockNCTable(TABLE); -#if GS_WITH_GC - [collector enable]; -#endif /* * Now send all the notifications. _______________________________________________ Gnustep-cvs mailing list Gnustep-cvs@gna.org https://mail.gna.org/listinfo/gnustep-cvs