Overview
Comment: | Add generator for amiga-glue.m |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
61c7afc08509f19692ef7ddb5e4c1b72 |
User & Date: | js on 2020-12-29 22:37:56 |
Other Links: | manifest | tags |
Context
2020-12-29
| ||
22:42 | Update buildsys check-in: b8ff7d6e0e user: js tags: trunk | |
22:37 | Add generator for amiga-glue.m check-in: 61c7afc085 user: js tags: trunk | |
19:41 | -[longLongValueWithBase:]: Fall back to base 10 check-in: 86055ffb5b user: js tags: trunk | |
Changes
Added generators/library/GlueGenerator.h version [c982e6064d].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018, 2019, 2020 * Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" #import "OFStream.h" #import "OFXMLElement.h" @interface GlueGenerator: OFObject { OFXMLElement *_library; OFStream *_outputStream; } - (instancetype)initWithLibrary: (OFXMLElement *)library outputStream: (OFStream *)outputStream; - (void)generate; @end |
Added generators/library/GlueGenerator.m version [a45c4e65ce].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | /* * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, * 2018, 2019, 2020 * Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFArray.h" #import "OFXMLAttribute.h" #import "GlueGenerator.h" #import "OFInvalidFormatException.h" #import "OFUnsupportedVersionException.h" #import "copyright.h" @implementation GlueGenerator - (instancetype)initWithLibrary: (OFXMLElement *)library outputStream: (OFStream *)outputStream { self = [super init]; @try { OFXMLAttribute *version; if (![library.name isEqual: @"amiga-library"] || library.namespace != nil) @throw [OFInvalidFormatException exception]; if ((version = [library attributeForName: @"version"]) == nil) @throw [OFInvalidFormatException exception]; if (![version.stringValue isEqual: @"1.0"]) @throw [OFUnsupportedVersionException exceptionWithVersion: version.stringValue]; _library = [library retain]; _outputStream = [outputStream retain]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_library release]; [_outputStream release]; [super dealloc]; } - (void)generate { [_outputStream writeString: COPYRIGHT]; [_outputStream writeString: @"/* This file is automatically generated from library.xml */\n" @"\n" @"#include \"config.h\"\n" @"\n"]; for (OFXMLElement *include in [_library elementsForName: @"include"]) [_outputStream writeFormat: @"#import \"%@\"\n", include.stringValue]; [_outputStream writeString: @"\n" @"#ifdef OF_AMIGAOS_M68K\n" @"# define PPC_PARAMS(...) (void)\n" @"# define M68K_ARG(type, name, reg)\t\t\\\n" @"\tregister type reg##name __asm__(#reg);\t\\\n" @"\ttype name = reg##name;\n" @"#else\n" @"# define PPC_PARAMS(...) (__VA_ARGS__)\n" @"# define M68K_ARG(...)\n" @"#endif\n" @"\n" @"#ifdef OF_MORPHOS\n" @"/* All __saveds functions in this file need to use the SysV " @"ABI */\n" @"__asm__ (\n" @" \".section .text\\n\"\n" @" \".align 2\\n\"\n" @" \"__restore_r13:\\n\"\n" @" \"\tlwz\t%r13, 44(%r12)\\n\"\n" @" \"\tblr\\n\"\n" @");\n" @"#endif\n"]; for (OFXMLElement *function in [_library elementsForName: @"function"]) { OFString *name = [function attributeForName: @"name"].stringValue; OFString *returnType = [function attributeForName: @"return-type"].stringValue; OFArray OF_GENERIC(OFXMLElement *) *arguments = [function elementsForName: @"argument"]; size_t argumentIndex; if (returnType == nil) returnType = @"void"; [_outputStream writeFormat: @"\n" @"%@ __saveds\n" @"glue_%@", returnType, name]; if (arguments.count > 0) [_outputStream writeString: @" PPC_PARAMS("]; else [_outputStream writeString: @"(void"]; argumentIndex = 0; for (OFXMLElement *argument in arguments) { OFString *argName = [argument attributeForName: @"name"].stringValue; OFString *argType = [argument attributeForName: @"type"].stringValue; if (argumentIndex++ > 0) [_outputStream writeString: @", "]; [_outputStream writeString: argType]; if (![argType hasSuffix: @"*"]) [_outputStream writeString: @" "]; [_outputStream writeString: argName]; } [_outputStream writeString: @")\n{\n"]; for (OFXMLElement *argument in arguments) { OFString *argName = [argument attributeForName: @"name"].stringValue; OFString *argType = [argument attributeForName: @"type"].stringValue; OFString *m68kReg = [argument attributeForName: @"m68k-reg"].stringValue; [_outputStream writeFormat: @"\tM68K_ARG(%@, %@, %@)\n", argType, argName, m68kReg]; } if (arguments.count > 0) [_outputStream writeString: @"\n"]; if (![returnType isEqual: @"void"]) [_outputStream writeString: @"\treturn "]; else [_outputStream writeString: @"\t"]; [_outputStream writeFormat: @"%@(", name]; argumentIndex = 0; for (OFXMLElement *argument in arguments) { OFString *argName = [argument attributeForName: @"name"].stringValue; if (argumentIndex++ > 0) [_outputStream writeString: @", "]; [_outputStream writeString: argName]; } [_outputStream writeString: @");\n}\n"]; } } @end |
Modified generators/library/LibraryGenerator.m from [5c3dcfdff0] to [891a3f630d].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #import "OFApplication.h" #import "OFFile.h" #import "OFFileManager.h" #import "OFURL.h" #import "OFXMLElement.h" #import "LinkLibGenerator.h" @interface LibraryGenerator: OFObject <OFApplicationDelegate> @end OF_APPLICATION_DELEGATE(LibraryGenerator) @implementation LibraryGenerator - (void)applicationDidFinishLaunching { OFURL *sourcesURL = [[OFFileManager defaultManager].currentDirectoryURL URLByAppendingPathComponent: @"../../src"]; | > | | > > | | > > > > > > | 19 20 21 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 57 58 59 60 61 62 63 64 | #import "OFApplication.h" #import "OFFile.h" #import "OFFileManager.h" #import "OFURL.h" #import "OFXMLElement.h" #import "GlueGenerator.h" #import "LinkLibGenerator.h" @interface LibraryGenerator: OFObject <OFApplicationDelegate> @end OF_APPLICATION_DELEGATE(LibraryGenerator) @implementation LibraryGenerator - (void)applicationDidFinishLaunching { OFURL *sourcesURL = [[OFFileManager defaultManager].currentDirectoryURL URLByAppendingPathComponent: @"../../src"]; OFURL *runtimeLibraryURL = [sourcesURL URLByAppendingPathComponent: @"runtime/library.xml"]; OFURL *runtimeLinkLibURL = [sourcesURL URLByAppendingPathComponent: @"runtime/linklib/linklib.m"]; OFURL *runtimeGlueURL = [sourcesURL URLByAppendingPathComponent: @"runtime/amiga-glue.m"]; OFXMLElement *runtimeLibrary = [OFXMLElement elementWithStream: [OFFile fileWithURL: runtimeLibraryURL mode: @"r"]]; OFFile *runtimeLinkLib = [OFFile fileWithURL: runtimeLinkLibURL mode: @"w"]; OFFile *runtimeGlue = [OFFile fileWithURL: runtimeGlueURL mode: @"w"]; LinkLibGenerator *runtimeLinkLibGenerator = [[[LinkLibGenerator alloc] initWithLibrary: runtimeLibrary outputStream: runtimeLinkLib] autorelease]; GlueGenerator *runtimeGlueGenerator = [[[GlueGenerator alloc] initWithLibrary: runtimeLibrary outputStream: runtimeGlue] autorelease]; [runtimeLinkLibGenerator generate]; [runtimeGlueGenerator generate]; [OFApplication terminate]; } @end |
Modified generators/library/Makefile from [1ffdf44043] to [bf61cd7572].
1 2 3 | include ../../extra.mk PROG_NOINST = gen_libraries${PROG_SUFFIX} | > | | 1 2 3 4 5 6 7 8 9 10 11 12 | include ../../extra.mk PROG_NOINST = gen_libraries${PROG_SUFFIX} SRCS = GlueGenerator.m \ LibraryGenerator.m \ LinkLibGenerator.m .PHONY: run run: all rm -f libobjfw.so.${OBJFW_LIB_MAJOR} rm -f libobjfw.so.${OBJFW_LIB_MAJOR_MINOR} rm -f objfw.dll libobjfw.${OBJFW_LIB_MAJOR}.dylib |
︙ | ︙ |
Modified src/runtime/amiga-glue.m from [5e437fee3a] to [5e933555c5].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "ObjFWRT.h" #import "private.h" | > > < | > > < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ /* This file is automatically generated from library.xml */ #include "config.h" #import "ObjFWRT.h" #import "private.h" #ifdef OF_AMIGAOS_M68K # define PPC_PARAMS(...) (void) # define M68K_ARG(type, name, reg) \ register type reg##name __asm__(#reg); \ type name = reg##name; #else # define PPC_PARAMS(...) (__VA_ARGS__) # define M68K_ARG(...) #endif #ifdef OF_MORPHOS /* All __saveds functions in this file need to use the SysV ABI */ __asm__ ( ".section .text\n" ".align 2\n" "__restore_r13:\n" " lwz %r13, 44(%r12)\n" |
︙ | ︙ | |||
48 49 50 51 52 53 54 | M68K_ARG(unsigned int, version, d0) M68K_ARG(struct objc_libc *, libc, a0) return objc_init(version, libc); } void __saveds | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | < < | | | | | | < | | < | | | | | < | | | < | | | | | < | | | < < < < | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | < | | | | | < | | | | | | | | | | | | | | | | | < | | | | < | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | < | < | | | | | < | | | < | | | | | | | | | | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 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 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 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 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 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 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 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 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 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 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | M68K_ARG(unsigned int, version, d0) M68K_ARG(struct objc_libc *, libc, a0) return objc_init(version, libc); } void __saveds glue___objc_exec_class PPC_PARAMS(struct objc_module *_Nonnull module) { M68K_ARG(struct objc_module *_Nonnull, module, a0) __objc_exec_class(module); } IMP _Nonnull __saveds glue_objc_msg_lookup PPC_PARAMS(id _Nullable object, SEL _Nonnull selector) { M68K_ARG(id _Nullable, object, a0) M68K_ARG(SEL _Nonnull, selector, a1) return objc_msg_lookup(object, selector); } IMP _Nonnull __saveds glue_objc_msg_lookup_stret PPC_PARAMS(id _Nullable object, SEL _Nonnull selector) { M68K_ARG(id _Nullable, object, a0) M68K_ARG(SEL _Nonnull, selector, a1) return objc_msg_lookup_stret(object, selector); } IMP _Nonnull __saveds glue_objc_msg_lookup_super PPC_PARAMS(struct objc_super *_Nonnull super, SEL _Nonnull selector) { M68K_ARG(struct objc_super *_Nonnull, super, a0) M68K_ARG(SEL _Nonnull, selector, a1) return objc_msg_lookup_super(super, selector); } IMP _Nonnull __saveds glue_objc_msg_lookup_super_stret PPC_PARAMS(struct objc_super *_Nonnull super, SEL _Nonnull selector) { M68K_ARG(struct objc_super *_Nonnull, super, a0) M68K_ARG(SEL _Nonnull, selector, a1) return objc_msg_lookup_super_stret(super, selector); } Class _Nullable __saveds glue_objc_lookUpClass PPC_PARAMS(const char *_Nonnull name) { M68K_ARG(const char *_Nonnull, name, a0) return objc_lookUpClass(name); } Class _Nullable __saveds glue_objc_getClass PPC_PARAMS(const char *_Nonnull name) { M68K_ARG(const char *_Nonnull, name, a0) return objc_getClass(name); } Class _Nonnull __saveds glue_objc_getRequiredClass PPC_PARAMS(const char *_Nonnull name) { M68K_ARG(const char *_Nonnull, name, a0) return objc_getRequiredClass(name); } Class _Nullable __saveds glue_objc_lookup_class PPC_PARAMS(const char *_Nonnull name) { M68K_ARG(const char *_Nonnull, name, a0) return objc_lookup_class(name); } Class _Nonnull __saveds glue_objc_get_class PPC_PARAMS(const char *_Nonnull name) { M68K_ARG(const char *_Nonnull, name, a0) return objc_get_class(name); } void __saveds glue_objc_exception_throw PPC_PARAMS(id _Nonnull object) { M68K_ARG(id _Nonnull, object, a0) objc_exception_throw(object); } int __saveds glue_objc_sync_enter PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_sync_enter(object); } int __saveds glue_objc_sync_exit PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_sync_exit(object); } id _Nullable __saveds glue_objc_getProperty PPC_PARAMS(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, bool atomic) { M68K_ARG(id _Nonnull, self, a0) M68K_ARG(SEL _Nonnull, _cmd, a1) M68K_ARG(ptrdiff_t, offset, d0) M68K_ARG(bool, atomic, d1) return objc_getProperty(self, _cmd, offset, atomic); } void __saveds glue_objc_setProperty PPC_PARAMS(id _Nonnull self, SEL _Nonnull _cmd, ptrdiff_t offset, id _Nullable value, bool atomic, signed char copy) { M68K_ARG(id _Nonnull, self, a0) M68K_ARG(SEL _Nonnull, _cmd, a1) M68K_ARG(ptrdiff_t, offset, d0) M68K_ARG(id _Nullable, value, a2) M68K_ARG(bool, atomic, d1) M68K_ARG(signed char, copy, d2) objc_setProperty(self, _cmd, offset, value, atomic, copy); } void __saveds glue_objc_getPropertyStruct PPC_PARAMS(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong) { M68K_ARG(void *_Nonnull, dest, a0) M68K_ARG(const void *_Nonnull, src, a1) M68K_ARG(ptrdiff_t, size, d0) M68K_ARG(bool, atomic, d1) M68K_ARG(bool, strong, d2) objc_getPropertyStruct(dest, src, size, atomic, strong); } void __saveds glue_objc_setPropertyStruct PPC_PARAMS(void *_Nonnull dest, const void *_Nonnull src, ptrdiff_t size, bool atomic, bool strong) { M68K_ARG(void *_Nonnull, dest, a0) M68K_ARG(const void *_Nonnull, src, a1) M68K_ARG(ptrdiff_t, size, d0) M68K_ARG(bool, atomic, d1) M68K_ARG(bool, strong, d2) objc_setPropertyStruct(dest, src, size, atomic, strong); } void __saveds glue_objc_enumerationMutation PPC_PARAMS(id _Nonnull object) { M68K_ARG(id _Nonnull, object, a0) objc_enumerationMutation(object); } int __saveds glue___gnu_objc_personality PPC_PARAMS(int version, int actions, uint64_t *_Nonnull exClass, void *_Nonnull ex, void *_Nonnull ctx) { M68K_ARG(int, version, d0) M68K_ARG(int, actions, d1) M68K_ARG(uint64_t *_Nonnull, exClass, d2) M68K_ARG(void *_Nonnull, ex, a0) M68K_ARG(void *_Nonnull, ctx, a1) return __gnu_objc_personality(version, actions, exClass, ex, ctx); } id _Nullable __saveds glue_objc_retain PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_retain(object); } id _Nullable __saveds glue_objc_retainBlock PPC_PARAMS(id _Nullable block) { M68K_ARG(id _Nullable, block, a0) return objc_retainBlock(block); } id _Nullable __saveds glue_objc_retainAutorelease PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_retainAutorelease(object); } void __saveds glue_objc_release PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) objc_release(object); } id _Nullable __saveds glue_objc_autorelease PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_autorelease(object); } id _Nullable __saveds glue_objc_autoreleaseReturnValue PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_autoreleaseReturnValue(object); } id _Nullable __saveds glue_objc_retainAutoreleaseReturnValue PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_retainAutoreleaseReturnValue(object); } id _Nullable __saveds glue_objc_retainAutoreleasedReturnValue PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_retainAutoreleasedReturnValue(object); } id _Nullable __saveds glue_objc_storeStrong PPC_PARAMS(id _Nullable *_Nonnull object, id _Nullable value) { M68K_ARG(id _Nullable *_Nonnull, object, a0) M68K_ARG(id _Nullable, value, a1) return objc_storeStrong(object, value); } id _Nullable __saveds glue_objc_storeWeak PPC_PARAMS(id _Nullable *_Nonnull object, id _Nullable value) { M68K_ARG(id _Nullable *_Nonnull, object, a0) M68K_ARG(id _Nullable, value, a1) return objc_storeWeak(object, value); } id _Nullable __saveds glue_objc_loadWeakRetained PPC_PARAMS(id _Nullable *_Nonnull object) { M68K_ARG(id _Nullable *_Nonnull, object, a0) return objc_loadWeakRetained(object); } id _Nullable __saveds glue_objc_initWeak PPC_PARAMS(id _Nullable *_Nonnull object, id _Nullable value) { M68K_ARG(id _Nullable *_Nonnull, object, a0) M68K_ARG(id _Nullable, value, a1) return objc_initWeak(object, value); } void __saveds glue_objc_destroyWeak PPC_PARAMS(id _Nullable *_Nonnull object) { M68K_ARG(id _Nullable *_Nonnull, object, a0) objc_destroyWeak(object); } id _Nullable __saveds glue_objc_loadWeak PPC_PARAMS(id _Nullable *_Nonnull object) { M68K_ARG(id _Nullable *_Nonnull, object, a0) return objc_loadWeak(object); } void __saveds glue_objc_copyWeak PPC_PARAMS(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src) { M68K_ARG(id _Nullable *_Nonnull, dest, a0) M68K_ARG(id _Nullable *_Nonnull, src, a1) objc_copyWeak(dest, src); } void __saveds glue_objc_moveWeak PPC_PARAMS(id _Nullable *_Nonnull dest, id _Nullable *_Nonnull src) { M68K_ARG(id _Nullable *_Nonnull, dest, a0) M68K_ARG(id _Nullable *_Nonnull, src, a1) objc_moveWeak(dest, src); } SEL _Nonnull __saveds glue_sel_registerName PPC_PARAMS(const char *_Nonnull name) { M68K_ARG(const char *_Nonnull, name, a0) return sel_registerName(name); } const char *_Nonnull __saveds glue_sel_getName PPC_PARAMS(SEL _Nonnull selector) { M68K_ARG(SEL _Nonnull, selector, a0) return sel_getName(selector); } bool __saveds glue_sel_isEqual PPC_PARAMS(SEL _Nonnull selector1, SEL _Nonnull selector2) { M68K_ARG(SEL _Nonnull, selector1, a0) M68K_ARG(SEL _Nonnull, selector2, a1) return sel_isEqual(selector1, selector2); } Class _Nonnull __saveds glue_objc_allocateClassPair PPC_PARAMS(Class _Nullable superclass, const char *_Nonnull name, size_t extraBytes) { M68K_ARG(Class _Nullable, superclass, a0) M68K_ARG(const char *_Nonnull, name, a1) M68K_ARG(size_t, extraBytes, d0) return objc_allocateClassPair(superclass, name, extraBytes); } void __saveds glue_objc_registerClassPair PPC_PARAMS(Class _Nonnull class) { M68K_ARG(Class _Nonnull, class, a0) objc_registerClassPair(class); } unsigned int __saveds glue_objc_getClassList PPC_PARAMS(Class _Nonnull *_Nullable buffer, unsigned int count) { M68K_ARG(Class _Nonnull *_Nullable, buffer, a0) M68K_ARG(unsigned int, count, d0) return objc_getClassList(buffer, count); } Class _Nonnull *_Nonnull __saveds glue_objc_copyClassList PPC_PARAMS(unsigned int *_Nullable length) { M68K_ARG(unsigned int *_Nullable, length, a0) return objc_copyClassList(length); } bool __saveds glue_class_isMetaClass PPC_PARAMS(Class _Nullable class) { M68K_ARG(Class _Nullable, class, a0) return class_isMetaClass(class); } const char *_Nullable __saveds glue_class_getName PPC_PARAMS(Class _Nullable class) { M68K_ARG(Class _Nullable, class, a0) return class_getName(class); } Class _Nullable __saveds glue_class_getSuperclass PPC_PARAMS(Class _Nullable class) { M68K_ARG(Class _Nullable, class, a0) return class_getSuperclass(class); } unsigned long __saveds glue_class_getInstanceSize PPC_PARAMS(Class _Nullable class) { M68K_ARG(Class _Nullable, class, a0) return class_getInstanceSize(class); } bool __saveds glue_class_respondsToSelector PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(SEL _Nonnull, selector, a1) return class_respondsToSelector(class, selector); } bool __saveds glue_class_conformsToProtocol PPC_PARAMS(Class _Nullable class, Protocol *_Nonnull p) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(Protocol *_Nonnull, p, a1) return class_conformsToProtocol(class, p); } IMP _Nullable __saveds glue_class_getMethodImplementation PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(SEL _Nonnull, selector, a1) return class_getMethodImplementation(class, selector); } IMP _Nullable __saveds glue_class_getMethodImplementation_stret PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(SEL _Nonnull, selector, a1) return class_getMethodImplementation_stret(class, selector); } Method _Nullable __saveds glue_class_getInstanceMethod PPC_PARAMS(Class _Nullable class, SEL _Nonnull selector) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(SEL _Nonnull, selector, a1) return class_getInstanceMethod(class, selector); } bool __saveds glue_class_addMethod PPC_PARAMS(Class _Nonnull class, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding) { M68K_ARG(Class _Nonnull, class, a0) M68K_ARG(SEL _Nonnull, selector, a1) M68K_ARG(IMP _Nonnull, implementation, a2) M68K_ARG(const char *_Nullable, typeEncoding, a3) return class_addMethod(class, selector, implementation, typeEncoding); } IMP _Nullable __saveds glue_class_replaceMethod PPC_PARAMS(Class _Nonnull class, SEL _Nonnull selector, IMP _Nonnull implementation, const char *_Nullable typeEncoding) { M68K_ARG(Class _Nonnull, class, a0) M68K_ARG(SEL _Nonnull, selector, a1) M68K_ARG(IMP _Nonnull, implementation, a2) M68K_ARG(const char *_Nullable, typeEncoding, a3) return class_replaceMethod(class, selector, implementation, typeEncoding); } Class _Nullable __saveds glue_object_getClass PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return object_getClass(object); } Class _Nullable __saveds glue_object_setClass PPC_PARAMS(id _Nullable object, Class _Nonnull class) { M68K_ARG(id _Nullable, object, a0) M68K_ARG(Class _Nonnull, class, a1) return object_setClass(object, class); } const char *_Nullable __saveds glue_object_getClassName PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return object_getClassName(object); } const char *_Nonnull __saveds glue_protocol_getName PPC_PARAMS(Protocol *_Nonnull protocol) { M68K_ARG(Protocol *_Nonnull, protocol, a0) return protocol_getName(protocol); } bool __saveds glue_protocol_isEqual PPC_PARAMS(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2) { M68K_ARG(Protocol *_Nonnull, protocol1, a0) M68K_ARG(Protocol *_Nonnull, protocol2, a1) return protocol_isEqual(protocol1, protocol2); } bool __saveds glue_protocol_conformsToProtocol PPC_PARAMS(Protocol *_Nonnull protocol1, Protocol *_Nonnull protocol2) { M68K_ARG(Protocol *_Nonnull, protocol1, a0) M68K_ARG(Protocol *_Nonnull, protocol2, a1) return protocol_conformsToProtocol(protocol1, protocol2); } _Nullable objc_uncaught_exception_handler_t __saveds glue_objc_setUncaughtExceptionHandler PPC_PARAMS(objc_uncaught_exception_handler_t _Nullable handler) { M68K_ARG(objc_uncaught_exception_handler_t _Nullable, handler, a0) return objc_setUncaughtExceptionHandler(handler); } void __saveds glue_objc_setForwardHandler PPC_PARAMS(IMP _Nullable forward, IMP _Nullable stretForward) { M68K_ARG(IMP _Nullable, forward, a0) M68K_ARG(IMP _Nullable, stretForward, a1) objc_setForwardHandler(forward, stretForward); } void __saveds glue_objc_setEnumerationMutationHandler PPC_PARAMS(objc_enumeration_mutation_handler_t _Nullable hadler) { M68K_ARG(objc_enumeration_mutation_handler_t _Nullable, hadler, a0) objc_setEnumerationMutationHandler(hadler); } id _Nullable __saveds glue_objc_constructInstance PPC_PARAMS(Class _Nullable class, void *_Nullable bytes) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(void *_Nullable, bytes, a1) return objc_constructInstance(class, bytes); } void __saveds glue_objc_exit(void) { objc_exit(); } Ivar _Nullable *_Nullable __saveds glue_class_copyIvarList PPC_PARAMS(Class _Nullable class, unsigned int *_Nullable outCount) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(unsigned int *_Nullable, outCount, a1) return class_copyIvarList(class, outCount); } const char *_Nonnull __saveds glue_ivar_getName PPC_PARAMS(Ivar _Nonnull ivar) { M68K_ARG(Ivar _Nonnull, ivar, a0) return ivar_getName(ivar); } const char *_Nonnull __saveds glue_ivar_getTypeEncoding PPC_PARAMS(Ivar _Nonnull ivar) { M68K_ARG(Ivar _Nonnull, ivar, a0) return ivar_getTypeEncoding(ivar); } ptrdiff_t __saveds glue_ivar_getOffset PPC_PARAMS(Ivar _Nonnull ivar) { M68K_ARG(Ivar _Nonnull, ivar, a0) return ivar_getOffset(ivar); } Method _Nullable *_Nullable __saveds glue_class_copyMethodList PPC_PARAMS(Class _Nullable class, unsigned int *_Nullable outCount) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(unsigned int *_Nullable, outCount, a1) return class_copyMethodList(class, outCount); } SEL _Nonnull __saveds glue_method_getName PPC_PARAMS(Method _Nonnull method) { M68K_ARG(Method _Nonnull, method, a0) return method_getName(method); } const char *_Nullable __saveds glue_method_getTypeEncoding PPC_PARAMS(Method _Nonnull method) { M68K_ARG(Method _Nonnull, method, a0) return method_getTypeEncoding(method); } objc_property_t _Nullable *_Nullable __saveds glue_class_copyPropertyList PPC_PARAMS(Class _Nullable class, unsigned int *_Nullable outCount) { M68K_ARG(Class _Nullable, class, a0) M68K_ARG(unsigned int *_Nullable, outCount, a1) return class_copyPropertyList(class, outCount); } const char *_Nonnull __saveds glue_property_getName PPC_PARAMS(objc_property_t _Nonnull property) { M68K_ARG(objc_property_t _Nonnull, property, a0) return property_getName(property); } char *_Nullable __saveds glue_property_copyAttributeValue PPC_PARAMS(objc_property_t _Nonnull property, const char *_Nonnull name) { M68K_ARG(objc_property_t _Nonnull, property, a0) M68K_ARG(const char *_Nonnull, name, a1) return property_copyAttributeValue(property, name); } void *_Nullable __saveds glue_objc_destructInstance PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return objc_destructInstance(object); } void *_Null_unspecified __saveds glue_objc_autoreleasePoolPush(void) { return objc_autoreleasePoolPush(); } void __saveds glue_objc_autoreleasePoolPop PPC_PARAMS(void *_Null_unspecified pool) { M68K_ARG(void *_Null_unspecified, pool, a0) objc_autoreleasePoolPop(pool); } id _Nullable __saveds glue__objc_rootAutorelease PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return _objc_rootAutorelease(object); } struct objc_hashtable *_Nonnull __saveds glue_objc_hashtable_new PPC_PARAMS(objc_hashtable_hash_func hash, objc_hashtable_equal_func equal, uint32_t size) { M68K_ARG(objc_hashtable_hash_func, hash, a0) M68K_ARG(objc_hashtable_equal_func, equal, a1) M68K_ARG(uint32_t, size, d0) return objc_hashtable_new(hash, equal, size); } void __saveds glue_objc_hashtable_set PPC_PARAMS(struct objc_hashtable *_Nonnull table, const void *_Nonnull key, const void *_Nonnull object) { M68K_ARG(struct objc_hashtable *_Nonnull, table, a0) M68K_ARG(const void *_Nonnull, key, a1) M68K_ARG(const void *_Nonnull, object, a2) objc_hashtable_set(table, key, object); } void *_Nullable __saveds glue_objc_hashtable_get PPC_PARAMS(struct objc_hashtable *_Nonnull table, const void *_Nonnull key) { M68K_ARG(struct objc_hashtable *_Nonnull, table, a0) M68K_ARG(const void *_Nonnull, key, a1) return objc_hashtable_get(table, key); } void __saveds glue_objc_hashtable_delete PPC_PARAMS(struct objc_hashtable *_Nonnull table, const void *_Nonnull key) { M68K_ARG(struct objc_hashtable *_Nonnull, table, a0) M68K_ARG(const void *_Nonnull, key, a1) objc_hashtable_delete(table, key); } void __saveds glue_objc_hashtable_free PPC_PARAMS(struct objc_hashtable *_Nonnull table) { M68K_ARG(struct objc_hashtable *_Nonnull, table, a0) objc_hashtable_free(table); } void __saveds glue_objc_setTaggedPointerSecret PPC_PARAMS(uintptr_t secret) { M68K_ARG(uintptr_t, secret, d0) objc_setTaggedPointerSecret(secret); } int __saveds glue_objc_registerTaggedPointerClass PPC_PARAMS(Class _Nonnull class) { M68K_ARG(Class _Nonnull, class, a0) return objc_registerTaggedPointerClass(class); } bool __saveds glue_object_isTaggedPointer PPC_PARAMS(id _Nullable object) { M68K_ARG(id _Nullable, object, a0) return object_isTaggedPointer(object); } uintptr_t __saveds glue_object_getTaggedPointerValue PPC_PARAMS(id _Nonnull object) { M68K_ARG(id _Nonnull, object, a0) return object_getTaggedPointerValue(object); } id _Nullable __saveds glue_objc_createTaggedPointer PPC_PARAMS(int class, uintptr_t value) { M68K_ARG(int, class, d0) M68K_ARG(uintptr_t, value, d1) return objc_createTaggedPointer(class, value); } |
Modified src/runtime/private.h from [a61212a55a] to [c494a9268d].
︙ | ︙ | |||
268 269 270 271 272 273 274 275 276 277 278 279 280 281 | # include <ppcinline/macros.h> # define OBJC_M68K_ARG(type, name, reg) type name = (type)REG_##reg; # else # define OBJC_M68K_ARG(type, name, reg) \ register type reg_##name __asm__(#reg); \ type name = reg_##name; # endif #endif extern void objc_register_all_categories(struct objc_symtab *_Nonnull); extern struct objc_category *_Nullable *_Nullable objc_categories_for_class(Class _Nonnull); extern void objc_unregister_all_categories(void); extern void objc_initialize_class(Class _Nonnull); | > > > > > > > > > | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | # include <ppcinline/macros.h> # define OBJC_M68K_ARG(type, name, reg) type name = (type)REG_##reg; # else # define OBJC_M68K_ARG(type, name, reg) \ register type reg_##name __asm__(#reg); \ type name = reg_##name; # endif extern bool objc_init(unsigned int, struct objc_libc *); # ifdef HAVE_SJLJ_EXCEPTIONS # define __gnu_objc_personality(version, actions, exClass, ex, ctx) \ __gnu_objc_personality_sj0(version, actions, *exClass, ex, ctx) # else # define __gnu_objc_personality(version, actions, exClass, ex, ctx) \ __gnu_objc_personality_v0(version, actions, *exClass, ex, ctx) # endif #endif extern void objc_register_all_categories(struct objc_symtab *_Nonnull); extern struct objc_category *_Nullable *_Nullable objc_categories_for_class(Class _Nonnull); extern void objc_unregister_all_categories(void); extern void objc_initialize_class(Class _Nonnull); |
︙ | ︙ |