Differences From Artifact [4d946cf26f]:
- File
src/OFObject.m
— part of check-in
[546332b4d7]
at
2011-08-03 03:53:03
on branch trunk
— Always use the old GNU API, even with the new GNU runtime.
The new API of the new GNU runtime is currently too broken to be of any
use, thus we even use the old API when the new one is detected until
the new one has been fixed and offers a way to detect if it is the fixed
one. (user: js, size: 28868) [annotate] [blame] [check-ins using]
To Artifact [b3a44692ae]:
- File
src/OFObject.m
— part of check-in
[3f0940e36d]
at
2011-08-03 04:14:18
on branch trunk
— Use the well hidden __objc_update_dispatch_table_for_class() function.
The old GNU API actually does export a function to update the dtable,
however, it is not defined in the headers anymore starting with gcc 4.6. (user: js, size: 28095) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
39 40 41 42 43 44 45 | #import "OFOutOfRangeException.h" #import "macros.h" #if defined(OF_OBJFW_RUNTIME) # import <objfw-rt.h> #elif defined(OF_OLD_GNU_RUNTIME) | < | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #import "OFOutOfRangeException.h" #import "macros.h" #if defined(OF_OBJFW_RUNTIME) # import <objfw-rt.h> #elif defined(OF_OLD_GNU_RUNTIME) # import <objc/Protocol.h> #endif #ifdef _WIN32 # include <windows.h> #endif |
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #ifndef __BIGGEST_ALIGNMENT__ # define __BIGGEST_ALIGNMENT__ 16 #endif #define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + \ (__BIGGEST_ALIGNMENT__ - 1)) & ~(__BIGGEST_ALIGNMENT__ - 1)) #define PRE_IVAR ((struct pre_ivar*)(void*)((char*)self - PRE_IVAR_ALIGN)) static struct { Class isa; } alloc_failed_exception; static Class autoreleasePool = Nil; static SEL cxx_construct = NULL; | > > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #ifndef __BIGGEST_ALIGNMENT__ # define __BIGGEST_ALIGNMENT__ 16 #endif #define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + \ (__BIGGEST_ALIGNMENT__ - 1)) & ~(__BIGGEST_ALIGNMENT__ - 1)) #define PRE_IVAR ((struct pre_ivar*)(void*)((char*)self - PRE_IVAR_ALIGN)) #ifdef OF_OLD_GNU_RUNTIME extern void __objc_update_dispatch_table_for_class(Class); #endif static struct { Class isa; } alloc_failed_exception; static Class autoreleasePool = Nil; static SEL cxx_construct = NULL; |
︙ | ︙ | |||
122 123 124 125 126 127 128 | /* References for static linking */ void _references_to_categories_of_OFObject(void) { _OFObject_Serialization_reference = 1; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | /* References for static linking */ void _references_to_categories_of_OFObject(void) { _OFObject_Serialization_reference = 1; } @implementation OFObject + (void)load { #ifdef NEED_OBJC_SYNC_INIT if (!objc_sync_init()) { fputs("Runtime error: objc_sync_init() failed!\n", stderr); abort(); |
︙ | ︙ | |||
389 390 391 392 393 394 395 | if (sel_eq(iter->method_list[i].method_name, selector)) { IMP oldImp; oldImp = iter->method_list[i].method_imp; iter->method_list[i].method_imp = newImp; | > | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | if (sel_eq(iter->method_list[i].method_name, selector)) { IMP oldImp; oldImp = iter->method_list[i].method_imp; iter->method_list[i].method_imp = newImp; __objc_update_dispatch_table_for_class( (Class)self->class_pointer); return oldImp; } } assert([self addClassMethod: selector withTypeEncoding: method->method_types |
︙ | ︙ | |||
463 464 465 466 467 468 469 | if (sel_eq(iter->method_list[i].method_name, selector)) { IMP oldImp; oldImp = iter->method_list[i].method_imp; iter->method_list[i].method_imp = newImp; | | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | if (sel_eq(iter->method_list[i].method_name, selector)) { IMP oldImp; oldImp = iter->method_list[i].method_imp; iter->method_list[i].method_imp = newImp; __objc_update_dispatch_table_for_class(self); return oldImp; } } assert([self addInstanceMethod: selector withTypeEncoding: method->method_types |
︙ | ︙ | |||
535 536 537 538 539 540 541 | methodList->method_list[0].method_name = selector; methodList->method_list[0].method_types = typeEncoding; methodList->method_list[0].method_imp = implementation; ((Class)self)->methods = methodList; | | | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | methodList->method_list[0].method_name = selector; methodList->method_list[0].method_types = typeEncoding; methodList->method_list[0].method_imp = implementation; ((Class)self)->methods = methodList; __objc_update_dispatch_table_for_class(self); return YES; #else @throw [OFNotImplementedException newWithClass: self selector: _cmd]; #endif } |
︙ | ︙ | |||
578 579 580 581 582 583 584 | methodList->method_list[0].method_name = selector; methodList->method_list[0].method_types = typeEncoding; methodList->method_list[0].method_imp = implementation; ((Class)self->class_pointer)->methods = methodList; | | | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | methodList->method_list[0].method_name = selector; methodList->method_list[0].method_types = typeEncoding; methodList->method_list[0].method_imp = implementation; ((Class)self->class_pointer)->methods = methodList; __objc_update_dispatch_table_for_class((Class)self->class_pointer); return YES; #else @throw [OFNotImplementedException newWithClass: self selector: _cmd]; #endif } |
︙ | ︙ |