Comment: | runtime: Make methods opaque and provide an API |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f310bcc3ff69a8555ff65edb72bd2a29 |
User & Date: | js on 2019-12-08 21:51:59 |
Other Links: | manifest | tags |
2019-12-09
| ||
00:49 | Fix compilation on FreeBSD check-in: f39368efd8 user: js tags: trunk | |
2019-12-08
| ||
21:51 | runtime: Make methods opaque and provide an API check-in: f310bcc3ff user: js tags: trunk | |
2019-11-26
| ||
21:57 | Work around struct objc_class marked unavailable check-in: c95c52fe98 user: js tags: trunk | |
Modified src/OFIntrospection.m from [87a3a4c527] to [22873e1cb7].
︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - - - - - - - - - - - - - - - - - - - - - | @synthesize selector = _selector, name = _name, typeEncoding = _typeEncoding; - (instancetype)init { OF_INVALID_INIT_METHOD } |
︙ | |||
438 439 440 441 442 443 444 445 | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } - (instancetype)initWithClass: (Class)class { self = [super init]; @try { Method *methodList; Ivar *iVarList; #if defined(OF_OBJFW_RUNTIME) |
︙ | |||
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - | autorelease]]; objc_autoreleasePoolPop(pool); } @finally { free(methodList); } iVarList = class_copyIvarList(class, &count); @try { pool = objc_autoreleasePoolPush(); for (unsigned int i = 0; i < count; i++) [_instanceVariables addObject: [[[OFInstanceVariable alloc] of_initWithIVar: iVarList[i]] autorelease]]; objc_autoreleasePoolPop(pool); } @finally { free(iVarList); } #if defined(OF_OBJFW_RUNTIME) for (propertyList = class->properties; propertyList != NULL; propertyList = propertyList->next) { pool = objc_autoreleasePoolPush(); for (unsigned int i = 0; i < propertyList->count; i++) [_properties addObject: [[[OFProperty alloc] of_initWithProperty: &propertyList->properties[i]] autorelease]]; objc_autoreleasePoolPop(pool); } #elif defined(OF_APPLE_RUNTIME) propertyList = class_copyPropertyList(class, &count); @try { pool = objc_autoreleasePoolPush(); for (unsigned int i = 0; i < count; i++) [_properties addObject: [[[OFProperty alloc] of_initWithProperty: propertyList[i]] autorelease]]; objc_autoreleasePoolPop(pool); } @finally { free(propertyList); } #else # error Invalid ObjC runtime! #endif |
︙ |
Modified src/OFObject.m from [c440638f52] to [349b3d550a].
︙ | |||
360 361 362 363 364 365 366 367 368 369 370 | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | return class_replaceMethod(self, selector, method, typeEncodingForSelector(class, selector)); } + (void)inheritMethodsFromClass: (Class)class { Class superclass = [self superclass]; Method *methodList; unsigned int count; if ([self isSubclassOfClass: class]) return; |
︙ | |||
444 445 446 447 448 449 450 | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | - | [self replaceInstanceMethod: selector withMethodFromClass: class]; } } @finally { free(methodList); } |
︙ |
Modified src/runtime/Makefile from [4f7f906070] to [461ba255ad].
︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + | class.m \ dtable.m \ exception.m \ hashtable.m \ init.m \ ivar.m \ lookup.m \ method.m \ misc.m \ property.m \ protocol.m \ selector.m \ sparsearray.m \ static-instances.m \ synchronized.m \ |
︙ |
Modified src/runtime/ObjFWRT.h from [48a67ef497] to [e3e943bde0].
︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | + | #define nil (id _Null_unspecified)0 #define YES true #define NO false typedef struct objc_class *Class; typedef struct objc_object *id; typedef const struct objc_selector *SEL; typedef const struct objc_method *Method; typedef const struct objc_ivar *Ivar; #if !defined(__wii__) && !defined(__amigaos__) typedef bool BOOL; #endif typedef id _Nullable (*IMP)(id _Nonnull, SEL _Nonnull, ...); typedef void (*objc_uncaught_exception_handler_t)(id _Nullable); typedef void (*objc_enumeration_mutation_handler_t)(id _Nonnull); |
︙ | |||
94 95 96 97 98 99 100 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - | OBJC_CLASS_INFO_NEW_ABI = 0x010, OBJC_CLASS_INFO_SETUP = 0x100, OBJC_CLASS_INFO_LOADED = 0x200, OBJC_CLASS_INFO_DTABLE = 0x400, OBJC_CLASS_INFO_INITIALIZED = 0x800 }; |
︙ | |||
246 247 248 249 250 251 252 253 254 255 256 257 258 259 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | + + + + | Class _Nonnull class_); extern const char *_Nullable object_getClassName(id _Nullable object); extern const char *_Nonnull protocol_getName(Protocol *_Nonnull protocol); extern bool protocol_isEqual(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2); extern bool protocol_conformsToProtocol(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2); extern Method _Nullable *_Nullable class_copyMethodList(Class _Nullable class_, unsigned int *_Nullable outCount); extern SEL _Nonnull method_getName(Method _Nonnull method); extern const char *_Nullable method_getTypeEncoding(Method _Nonnull method); extern Ivar _Nullable *_Nullable class_copyIvarList(Class _Nullable class_, unsigned int *_Nullable outCount); extern const char *_Nonnull ivar_getName(Ivar _Nonnull ivar); extern const char *_Nonnull ivar_getTypeEncoding(Ivar _Nonnull ivar); extern ptrdiff_t ivar_getOffset(Ivar _Nonnull ivar); extern void objc_exit(void); extern _Nullable objc_uncaught_exception_handler_t |
︙ |
Modified src/runtime/amiga-glue.m from [53f74ff653] to [fecc22bc77].
︙ | |||
662 663 664 665 666 667 668 | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | + + + + + + + + + + + + + + + + + + + + + + + + + | ptrdiff_t __saveds glue_ivar_getOffset PPC_PARAMS(Ivar ivar) { M68K_ARG(Ivar, ivar, a0) return ivar_getOffset(ivar); } Method * glue_class_copyMethodList PPC_PARAMS(Class class, unsigned int *outCount) { M68K_ARG(Class, class, a0) M68K_ARG(unsigned int *, outCount, a1) return class_copyMethodList(class, outCount); } SEL glue_method_getName PPC_PARAMS(Method method) { M68K_ARG(Method, method, a0) return method_getName(method); } const char * glue_method_getTypeEncoding PPC_PARAMS(Method method) { M68K_ARG(Method, method, a0) return method_getTypeEncoding(method); } |
Modified src/runtime/amiga-library.m from [f11cc5f9b0] to [ea7e18b3b9].
︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | + + + | extern void glue_objc_setEnumerationMutationHandler(void); extern void glue_objc_zero_weak_references(void); extern void glue_objc_exit(void); extern Ivar *glue_class_copyIvarList(void); extern const char *glue_ivar_getName(void); extern const char *glue_ivar_getTypeEncoding(void); extern ptrdiff_t glue_ivar_getOffset(void); extern Method *glue_class_copyMethodList(void); extern SEL glue_method_getName(void); extern const char *glue_method_getTypeEncoding(void); #ifdef OF_MORPHOS const ULONG __abox__ = 1; #endif struct ExecBase *SysBase; struct objc_libc libc; FILE *stdout; |
︙ | |||
639 640 641 642 643 644 645 646 647 648 649 650 651 652 | 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | + + + | (CONST_APTR)glue_objc_setEnumerationMutationHandler, (CONST_APTR)glue_objc_zero_weak_references, (CONST_APTR)glue_objc_exit, (CONST_APTR)glue_class_copyIvarList, (CONST_APTR)glue_ivar_getName, (CONST_APTR)glue_ivar_getTypeEncoding, (CONST_APTR)glue_ivar_getOffset, (CONST_APTR)glue_class_copyMethodList, (CONST_APTR)glue_method_getName, (CONST_APTR)glue_method_getTypeEncoding, (CONST_APTR)-1, #ifdef OF_MORPHOS (CONST_APTR)FUNCARRAY_END #endif }; #pragma GCC diagnostic pop |
︙ |
Modified src/runtime/amigaos3.sfd from [dd36c99661] to [2e99ad65a3].
︙ | |||
71 72 73 74 75 76 77 78 | 71 72 73 74 75 76 77 78 79 80 81 | + + + | void glue_objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler_t _Nullable handler)(a0) void glue_objc_zero_weak_references(id _Nonnull value)(a0) void glue_objc_exit(void)() Ivar _Nullable *_Nullable glue_class_copyIvarList(Class _Nullable class_, unsigned int *_Nullable outCount)(a0,a1) const char *_Nonnull glue_ivar_getName(Ivar _Nonnull ivar)(a0) const char *_Nonnull glue_ivar_getTypeEncoding(Ivar _Nonnull ivar)(a0) ptrdiff_t glue_ivar_getOffset(Ivar _Nonnull ivar)(a0) Method _Nullable *_Nullable glue_class_copyMethodList(Class _Nullable class_, unsigned int *_Nullable outCount)(a0,a1) SEL _Nonnull glue_method_getName(Method _Nonnull method)(a0) const char *_Nullable glue_method_getTypeEncoding(Method _Nonnull method)(a0) ==end |
Modified src/runtime/ivar.m from [d2a643d575] to [b1aba62100].
︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - - - + + + - - - + + - + + + + - - + + - - | Ivar * class_copyIvarList(Class class, unsigned int *outCount) { unsigned int count; Ivar *ivars; |
︙ |
Modified src/runtime/linklib/linklib.m from [701acb1f6d] to [2d8b4b35eb].
︙ | |||
611 612 613 614 615 616 617 | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | + + + + + + + + + + + + + + + + + + | } ptrdiff_t ivar_getOffset(Ivar ivar) { return glue_ivar_getOffset(ivar); } Method * class_copyMethodList(Class class, unsigned int *outCount) { return glue_class_copyMethodList(class, outCount); } SEL method_getName(Method method) { return glue_method_getName(method); } const char * method_getTypeEncoding(Method method) { return glue_method_getTypeEncoding(method); } |
Added src/runtime/method.m version [49dc632b0c].
|
Modified src/runtime/morphos-clib.h from [4d1d4f1cae] to [1eba9b9866].
︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 | + + + | void glue_objc_setEnumerationMutationHandler(objc_enumeration_mutation_handler_t); void glue_objc_zero_weak_references(id); void glue_objc_exit(void); Ivar *glue_class_copyIvarList(Class class_, unsigned int *outCount); const char *glue_ivar_getName(Ivar ivar); const char *glue_ivar_getTypeEncoding(Ivar ivar); ptrdiff_t glue_ivar_getOffset(Ivar ivar); Method *glue_class_copyMethodList(Class class_, unsigned int *outCount); SEL glue_method_getName(Method method); const char *glue_method_getTypeEncoding(Method method); |
Modified src/runtime/morphos.fd from [308b16b2df] to [4df918228d].
︙ | |||
67 68 69 70 71 72 73 74 | 67 68 69 70 71 72 73 74 75 76 77 | + + + | glue_objc_setEnumerationMutationHandler(handler)(sysv,r12base) glue_objc_zero_weak_references(value)(sysv,r12base) glue_objc_exit()(sysv,r12base) glue_class_copyIvarList(class_,outCount)(sysv,r12base) glue_ivar_getName(ivar)(sysv,r12base) glue_ivar_getTypeEncoding(ivar)(sysv,r12base) glue_ivar_getOffset(ivar)(sysv,r12base) glue_class_copyMethodList(class_,outCount)(sysv,r12base) glue_method_getName(method)(sysv,r12base) glue_method_getTypeEncoding(method)(sysv,r12base) ##end |
Modified src/runtime/private.h from [dd3eb1cd1b] to [81f62cf3b8].
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | # ifndef _Nonnull # define _Nonnull # endif # ifndef _Nullable # define _Nullable # endif #endif struct objc_object { Class _Nonnull isa; }; struct objc_selector { uintptr_t UID; const char *_Nullable typeEncoding; }; struct objc_method { struct objc_selector selector; IMP _Nonnull implementation; }; struct objc_method_list { struct objc_method_list *_Nullable next; unsigned int count; struct objc_method methods[1]; }; struct objc_category { const char *_Nonnull categoryName; const char *_Nonnull className; struct objc_method_list *_Nullable instanceMethods; struct objc_method_list *_Nullable classMethods; struct objc_protocol_list *_Nullable protocols; }; struct objc_ivar { const char *_Nonnull name; const char *_Nonnull typeEncoding; unsigned int offset; }; |
︙ |