diff --git a/ChangeLog b/ChangeLog index 0934788b7..b1bf7be5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sun Oct 25 08:00:00 1998 Richard Frith-Macdonald + + src/NSObject.m: Cache implementation for adding object to autorelease + pool to avoid objc runtime messaging overhead. + src/NSAutoreleasePool.m: Cache implementation for adding object to + src/NSAutoreleasePool.m: Cache implementation for adding object to + autorelease pool to avoid objc runtime messaging overhead. + src/NSGCString.m: Implemented ([+allocWithZone:]) + src/NSGString.m: Implemented ([+allocWithZone:]) + Sat Oct 24 11:30:00 1998 Richard Frith-Macdonald src/NSArchiver.m: New implementation diff --git a/Source/NSGCString.m b/Source/NSGCString.m index edced3b1c..e7ff46653 100644 --- a/Source/NSGCString.m +++ b/Source/NSGCString.m @@ -40,6 +40,11 @@ @implementation NSGCString ++ allocWithZone: (NSZone*)z +{ + return NSAllocateObject (self, 0, z); +} + - (void)dealloc { if (_zone) { @@ -479,6 +484,11 @@ @implementation NSGMutableCString ++ allocWithZone: (NSZone*)z +{ + return NSAllocateObject (self, 0, z); +} + + (void) initialize { static int done = 0; diff --git a/Source/NSGString.m b/Source/NSGString.m index 771e8fc5f..c4d0522fe 100644 --- a/Source/NSGString.m +++ b/Source/NSGString.m @@ -48,6 +48,11 @@ @implementation NSGString ++ allocWithZone: (NSZone*)z +{ + return NSAllocateObject (self, 0, z); +} + - (void)dealloc { if (_zone) @@ -319,6 +324,11 @@ // @protocol NSMutableString ++ allocWithZone: (NSZone*)z +{ + return NSAllocateObject (self, 0, z); +} + + (void) initialize { static int done = 0; diff --git a/Source/NSObject.m b/Source/NSObject.m index ebaf45601..23dadab64 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -346,6 +346,8 @@ NSShouldRetainWithZone (NSObject *anObject, NSZone *requestedZone) need mutex protection, since it is simply a pointer that gets read and set. */ static id autorelease_class = nil; +static SEL autorelease_sel = @selector(addObject:); +static IMP autorelease_imp = 0; /* When this is `YES', every call to release/autorelease, checks to make sure isn't being set up to release itself too many times. @@ -367,6 +369,7 @@ static BOOL double_release_check_enabled = NO; retain_counts_gate = objc_mutex_allocate (); #endif autorelease_class = [NSAutoreleasePool class]; + autorelease_imp = [autorelease_class methodForSelector: autorelease_sel]; _fastBuildCache(); } return; @@ -594,7 +597,7 @@ static BOOL double_release_check_enabled = NO; @"%d release(s) versus %d retain(s)", release_count, retain_count]; } - [autorelease_class addObject:self]; + (*autorelease_imp)(autorelease_class, autorelease_sel, self); return self; } @@ -921,6 +924,7 @@ static BOOL double_release_check_enabled = NO; + (void) setAutoreleaseClass: (Class)aClass { autorelease_class = aClass; + autorelease_imp = [self instanceMethodForSelector: autorelease_sel]; } + (Class) autoreleaseClass