Comment: | Add a fast path for objc_classname_to_class().
This should improve the performance for the GCC ABI, as As this performance improvement needs RAM, it is only used after 128 Runtime internal usage of objc_classname_to_class() does not use the |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
84a724dd4bdb6ac763d0930d6f7d3a37 |
User & Date: | js on 2013-12-06 00:52:26 |
Other Links: | manifest | tags |
2013-12-06
| ||
02:35 | Add x86/Win32 assembly lookup implementation. check-in: b527914a91 user: js tags: trunk | |
00:52 | Add a fast path for objc_classname_to_class(). check-in: 84a724dd4b user: js tags: trunk | |
2013-12-05
| ||
21:26 | Check for iOS in configure instead of macros.h. check-in: 8602025532 user: js tags: trunk | |
Modified src/runtime/category.m from [dc1249919c] to [58afce4465].
︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + | (struct objc_abi_selector*)&ml->methods[i]); } static void register_category(struct objc_abi_category *cat) { struct objc_abi_category **cats; |
︙ |
Modified src/runtime/class.m from [0500525bf9] to [e9b6e354b6].
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 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 | + + + + + + | #include <stdio.h> #include <stdlib.h> #include <string.h> #import "runtime.h" #import "runtime-private.h" struct sparsearray { void *next[256]; }; static struct objc_hashtable *classes = NULL; static Class *load_queue = NULL; static size_t load_queue_cnt = 0; static struct objc_sparsearray *empty_dtable = NULL; static unsigned lookups_till_fast_path = 128; static struct sparsearray *sparsearray = NULL; static void register_class(struct objc_abi_class *cls) { if (classes == NULL) classes = objc_hashtable_new(2); |
︙ | |||
63 64 65 66 67 68 69 | 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 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | for (ml = cls->methodlist; ml != NULL; ml = ml->next) for (i = 0; i < ml->count; i++) objc_register_selector( (struct objc_abi_selector*)&ml->methods[i]); } inline Class |
︙ | |||
235 236 237 238 239 240 241 | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | - + | { const char *superclass; if (cls->info & OBJC_CLASS_INFO_SETUP) return; if ((superclass = ((struct objc_abi_class*)cls)->superclass) != NULL) { |
︙ | |||
379 380 381 382 383 384 385 | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | - + - + | } } } id objc_lookUpClass(const char *name) { |
︙ | |||
629 630 631 632 633 634 635 636 637 638 639 | 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 | + + + + + + + + + + + + + + - + + + + | rcls->dtable = NULL; if (rcls->superclass != Nil) cls->superclass = rcls->superclass->name; objc_hashtable_set(classes, cls->name, NULL); } static void free_sparsearray(struct sparsearray *sa, size_t depth) { uint_fast16_t i; if (sa == NULL || depth == 0) return; for (i = 0; i < 256; i++) free_sparsearray(sa->next[i], depth - 1); free(sa); } void objc_free_all_classes(void) { |
Modified src/runtime/runtime-private.h from [ceb0d6303e] to [3c88a5e1a9].
︙ | |||
122 123 124 125 126 127 128 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - + | extern void objc_register_all_categories(struct objc_abi_symtab*); extern struct objc_category** objc_categories_for_class(Class); extern void objc_free_all_categories(void); extern void objc_initialize_class(Class); extern void objc_update_dtable(Class); extern void objc_register_all_classes(struct objc_abi_symtab*); |
︙ |