Switch the order of the reference count and the zone so that the reference count (in reference counted mode) is always immediately in front of the object. Please test this!!

Opt NSObject into the fast path for ARC.  ARC will now not call the retain / release / autorelease methods on NSObject or any classes that inherit their implementation of these methods from NSObject.  In quick and dirty testing, this gives about a 10-20% speedup.  



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33446 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Chisnall 2011-07-04 11:31:28 +00:00
parent 38566d1888
commit 2a2d7339d1

View file

@ -409,8 +409,8 @@ static inline NSLock *GSAllocationLockForObject(id p)
* (before the start) in each object.
*/
typedef struct obj_layout_unpadded {
NSUInteger retained;
NSZone *zone;
NSUInteger retained;
} unp;
#define UNP sizeof(unp)
@ -420,8 +420,8 @@ typedef struct obj_layout_unpadded {
* structure correct.
*/
struct obj_layout {
NSUInteger retained;
NSZone *zone;
NSUInteger retained;
char padding[ALIGN - ((UNP % ALIGN) ? (UNP % ALIGN) : ALIGN)];
};
typedef struct obj_layout *obj;
@ -963,6 +963,7 @@ NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone)
* </p>
*/
@implementation NSObject
- (void)_ARCCompliantRetainRelease {}
+ (void) _becomeMultiThreaded: (NSNotification *)aNotification
{