Differences From Artifact [b19596ca32]:
- File
src/OFObject.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: 21277) [annotate] [blame] [check-ins using]
To Artifact [2f8b3fda71]:
- File src/OFObject.m — part of check-in [20c584252c] at 2012-09-06 19:13:50 on branch trunk — Add objc_{construct,destruct}Instance(). (user: js, size: 20271) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
83 84 85 86 87 88 89 | (__BIGGEST_ALIGNMENT__ - 1)) & ~(__BIGGEST_ALIGNMENT__ - 1)) #define PRE_MEM(mem) ((struct pre_mem*)(void*)((char*)mem - PRE_MEM_ALIGN)) static struct { Class isa; } alloc_failed_exception; | < < < | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | (__BIGGEST_ALIGNMENT__ - 1)) & ~(__BIGGEST_ALIGNMENT__ - 1)) #define PRE_MEM(mem) ((struct pre_mem*)(void*)((char*)mem - PRE_MEM_ALIGN)) static struct { Class isa; } alloc_failed_exception; size_t of_pagesize; size_t of_num_cpus; #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) static void uncaught_exception_handler(id exception) { |
︙ | ︙ | |||
202 203 204 205 206 207 208 | exceptionWithClass: class]; } #endif instance = (OFObject*)((char*)instance + PRE_IVAR_ALIGN); memset(instance, 0, instanceSize); | | > > > > > | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | exceptionWithClass: class]; } #endif instance = (OFObject*)((char*)instance + PRE_IVAR_ALIGN); memset(instance, 0, instanceSize); if (!objc_constructInstance(class, instance)) { free((char*)instance - PRE_IVAR_ALIGN); @throw [OFInitializationFailedException exceptionWithClass: class]; } if OF_UNLIKELY (extra != NULL) *extra = (char*)instance + instanceSize + extraAlignment; return instance; } |
︙ | ︙ | |||
238 239 240 241 242 243 244 | objc_forward_handler = forward_handler; #endif #ifdef HAVE_OBJC_ENUMERATIONMUTATION objc_setEnumerationMutationHandler(enumeration_mutation_handler); #endif | < < < < < < < < < | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | objc_forward_handler = forward_handler; #endif #ifdef HAVE_OBJC_ENUMERATIONMUTATION objc_setEnumerationMutationHandler(enumeration_mutation_handler); #endif #if defined(_WIN32) SYSTEM_INFO si; GetSystemInfo(&si); of_pagesize = si.dwPageSize; of_num_cpus = si.dwNumberOfProcessors; #elif defined(__QNX__) if ((of_pagesize = sysconf(_SC_PAGESIZE)) < 1) |
︙ | ︙ | |||
507 508 509 510 511 512 513 | + (BOOL)resolveInstanceMethod: (SEL)selector { return NO; } - init { | < < < < < < < < < < < < < < < < < | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | + (BOOL)resolveInstanceMethod: (SEL)selector { return NO; } - init { return self; } - (Class)class { return object_getClass(self); } |
︙ | ︙ | |||
823 824 825 826 827 828 829 | - (BOOL)isProxy { return NO; } - (void)dealloc { | < < < < < < < < < < < | < < < | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | - (BOOL)isProxy { return NO; } - (void)dealloc { struct pre_mem *iter; objc_destructInstance(self); iter = PRE_IVAR->firstMem; while (iter != NULL) { struct pre_mem *next = iter->next; /* * We can use owner as a sentinel to prevent exploitation in |
︙ | ︙ |