Differences From Artifact [4cb79aa414]:
- File
src/runtime/class.m
— part of check-in
[5c0117205d]
at
2022-11-06 21:19:39
on branch trunk
— Work around an ICE in Clang 3.7.0 on Windows/x86
Apparently the optimizer crashes on some recursive functions. (user: js, size: 22277) [annotate] [blame] [check-ins using] [more...]
To Artifact [c32cd0bfe5]:
- File src/runtime/class.m — part of check-in [1106d5ad1d] at 2023-07-15 14:26:45 on branch trunk — runtime: Fix a comment (user: js, size: 22311) [annotate] [blame] [check-ins using] [more...]
1 | /* | | | 1 2 3 4 5 6 7 8 9 | /* * Copyright (c) 2008-2023 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. * |
︙ | ︙ | |||
54 55 56 57 58 59 60 | class_registerAlias_np(Class class, const char *name) { objc_globalMutex_lock(); if (classes == NULL) { objc_globalMutex_unlock(); | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | class_registerAlias_np(Class class, const char *name) { objc_globalMutex_lock(); if (classes == NULL) { objc_globalMutex_unlock(); return false; } objc_hashtable_set(classes, name, (Class)((uintptr_t)class | 1)); objc_globalMutex_unlock(); return true; } static void registerSelectors(Class class) { struct objc_method_list *iter; unsigned int i; |
︙ | ︙ | |||
88 89 90 91 92 93 94 | return Nil; /* * Fast path * * Instead of looking up the string in a dictionary, which needs * locking, we use a sparse array to look up the pointer. If | | | | | | | | 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 | return Nil; /* * Fast path * * Instead of looking up the string in a dictionary, which needs * locking, we use a sparse array to look up the pointer. If * objc_classnameToClass() gets called a lot, it is most likely that * the GCC ABI is used, which always calls into objc_lookup_class(), or * that it is used in a loop by the user. In both cases, it is very * likely that the same string pointer is passed again and again. * * This is not used before objc_classnameToClass() has been called a * certain amount of times, so that no memory is wasted if it is only * used rarely, for example if the ObjFW ABI is used and the user does * not call it in a loop. * * Runtime internal usage does not use the fast path and does not count * as a call into objc_classnameToClass(). The reason for this is that * if the runtime calls into objc_classnameToClass(), it already has * the lock and thus the performance gain would be small, but it would * waste memory. */ if (cache && fastPath != NULL) { class = objc_sparsearray_get(fastPath, (uintptr_t)name); if (class != Nil) return class; } |
︙ | ︙ | |||
776 777 778 779 780 781 782 | class->methodList = methodList; objc_updateDTable(class); } Method | > | | 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | class->methodList = methodList; objc_updateDTable(class); } Method #if defined(__clang__) && __has_attribute(__optnone__) && \ __clang_major__ == 3 && __clang_minor__ <= 7 /* Work around an ICE in Clang 3.7.0 on Windows/x86 */ __attribute__((__optnone__)) #endif class_getInstanceMethod(Class class, SEL selector) { Method method; Class superclass; |
︙ | ︙ |