ObjFW  Check-in [1106d5ad1d]

Overview
Comment:runtime: Fix a comment
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1106d5ad1da4f9c7691dfe8aa2b9da9859c9a4d8292b205ca9b454a977701656
User & Date: js on 2023-07-15 14:26:45
Other Links: manifest | tags
Context
2023-07-15
14:48
platform.h: Add OF_HURD check-in: 340a3ac277 user: js tags: trunk
14:26
runtime: Fix a comment check-in: 1106d5ad1d user: js tags: trunk
2023-06-20
20:30
OFIPXSocketTests: Skip if we have no address check-in: c4b7136091 user: js tags: trunk
Changes

Modified src/runtime/class.m from [13704fc982] to [c32cd0bfe5].

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
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_classname_to_class() gets called a lot, it is most likely that
	 * 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_classname_to_class() has been called a
	 * 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_classname_to_class(). The reason for this is
	 * that if the runtime calls into objc_classname_to_class(), it already
	 * has the lock and thus the performance gain would be small, but it
	 * would waste memory.
	 * 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;
	}