Differences From Artifact [e0bf0f6365]:
- File
src/OFIntrospection.m
— part of check-in
[1255f3a11a]
at
2012-08-10 20:08:24
on branch trunk
— Directly use the runtime's autorelease pools.
This greatly improves performance, as it gets rid of the overhead of
OFAutoreleasePool. (user: js, size: 7540) [annotate] [blame] [check-ins using]
To Artifact [f04bb94239]:
- File
src/OFIntrospection.m
— part of check-in
[28cc9a516e]
at
2012-09-06 19:13:43
on branch trunk
— OFIntrospection: Remove property introspection.
This seems to be too buggy in compilers, at least when using GNU-style
runtimes (neither GCC nor Clang emit them correctly there right now). (user: js, size: 6214) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
162 163 164 165 166 167 168 | { return [OFString stringWithFormat: @"<OFInstanceVariable: %@ [%s] @ 0x%tx>", name, typeEncoding, offset]; } @end | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | { return [OFString stringWithFormat: @"<OFInstanceVariable: %@ [%s] @ 0x%tx>", name, typeEncoding, offset]; } @end @implementation OFIntrospection + introspectionWithClass: (Class)class { return [[[self alloc] initWithClass: class] autorelease]; } - initWithClass: (Class)class { self = [super init]; @try { #if defined(OF_OBJFW_RUNTIME) struct objc_method_list *methodList; #elif defined(OF_APPLE_RUNTIME) Method *methodList; Ivar *ivarList; unsigned i, count; #endif classMethods = [[OFMutableArray alloc] init]; instanceMethods = [[OFMutableArray alloc] init]; instanceVariables = [[OFMutableArray alloc] init]; #if defined(OF_OBJFW_RUNTIME) for (methodList = object_getClass(class)->methodlist; methodList != NULL; methodList = methodList->next) { int i; for (i = 0; i < methodList->count; i++) { |
︙ | ︙ | |||
276 277 278 279 280 281 282 | _initWithIvar: &class->ivars->ivars[i]]; [instanceVariables addObject: [ivar autorelease]]; objc_autoreleasePoolPop(pool); } } | < < | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | _initWithIvar: &class->ivars->ivars[i]]; [instanceVariables addObject: [ivar autorelease]]; objc_autoreleasePoolPop(pool); } } #elif defined(OF_APPLE_RUNTIME) methodList = class_copyMethodList(object_getClass(class), &count); @try { for (i = 0; i < count; i++) { void *pool = objc_autoreleasePoolPush(); [classMethods addObject: [[[OFMethod alloc] |
︙ | ︙ | |||
318 319 320 321 322 323 324 | [[[OFInstanceVariable alloc] _initWithIvar: ivarList[i]] autorelease]]; objc_autoreleasePoolPop(pool); } } @finally { free(ivarList); } | < < < < < < < < < < < < < < < < < < < < | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | [[[OFInstanceVariable alloc] _initWithIvar: ivarList[i]] autorelease]]; objc_autoreleasePoolPop(pool); } } @finally { free(ivarList); } #endif [classMethods makeImmutable]; [instanceMethods makeImmutable]; [instanceVariables makeImmutable]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [classMethods release]; [instanceMethods release]; [instanceVariables release]; [super dealloc]; } - (OFArray*)classMethods { OF_GETTER(classMethods, YES) |
︙ | ︙ |