Overview
Comment: | Use the well hidden __objc_update_dispatch_table_for_class() function.
The old GNU API actually does export a function to update the dtable, |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3f0940e36d23a847b976ccd4dac2826f |
User & Date: | js on 2011-08-03 04:14:18 |
Other Links: | manifest | tags |
Context
2011-08-03
| ||
16:25 | Fix a few OFString tests. check-in: cc93f51348 user: js tags: trunk | |
04:14 | Use the well hidden __objc_update_dispatch_table_for_class() function. check-in: 3f0940e36d user: js tags: trunk | |
03:53 | Always use the old GNU API, even with the new GNU runtime. check-in: 546332b4d7 user: js tags: trunk | |
Changes
Modified src/OFObject.m from [4d946cf26f] to [b3a44692ae].
︙ | ︙ | |||
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 } |
︙ | ︙ |