ObjFW  Check-in [46105d56c7]

Overview
Comment:Add class_getMethodImplementation().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | runtime
Files: files | file ages | folders
SHA3-256: 46105d56c7bc52cb5373d8ce862edb4c0029d46c24737838077b04fb941c9064
User & Date: js on 2012-03-23 14:54:19
Other Links: branch diff | manifest | tags
Context
2012-03-23
15:42
rootclass->isa->superclass is rootclass. check-in: aa179b6d0a user: js tags: runtime
14:54
Add class_getMethodImplementation(). check-in: 46105d56c7 user: js tags: runtime
12:59
Move objc_{properties,sync} to runtime. check-in: adbce6d8f4 user: js tags: runtime
Changes

Modified src/OFObject.m from [99d74c377b] to [946762df81].

283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
283
284
285
286
287
288
289



290

291
292
293
294
295
296
297







-
-
-

-







			return YES;

	return NO;
}

+ (IMP)instanceMethodForSelector: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	return objc_get_instance_method(self, selector);
#else
	return class_getMethodImplementation(self, selector);
#endif
}

+ (const char*)typeEncodingForInstanceSelector: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	const char *ret;

515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
511
512
513
514
515
516
517



518

519
520
521
522
523
524
525







-
-
-

-







- (BOOL)conformsToProtocol: (Protocol*)protocol
{
	return [isa conformsToProtocol: protocol];
}

- (IMP)methodForSelector: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	return objc_msg_lookup(self, selector);
#else
	return class_getMethodImplementation(isa, selector);
#endif
}

- (id)performSelector: (SEL)selector
{
	id (*imp)(id, SEL) = (id(*)(id, SEL))[self methodForSelector: selector];

	return imp(self, selector);

Modified src/runtime/class.m from [c6f580ab0e] to [16e53b23a5].

276
277
278
279
280
281
282
283

284
285
286
287
288
289
290
291
292
293
294
295
296
276
277
278
279
280
281
282

283






284
285
286
287
288
289
290







-
+
-
-
-
-
-
-







unsigned long
class_getInstanceSize(Class cls)
{
	return cls->instance_size;
}

IMP
objc_get_class_method(Class cls, SEL sel)
class_getMethodImplementation(Class cls, SEL sel)
{
	return objc_sparsearray_get(cls->isa->dtable, (uint32_t)sel->uid);
}

IMP
objc_get_instance_method(Class cls, SEL sel)
{
	return objc_sparsearray_get(cls->dtable, (uint32_t)sel->uid);
}

const char*
objc_get_type_encoding(Class cls, SEL sel)
{

Modified src/runtime/runtime.h from [5e1f1b3197] to [a509668aea].

104
105
106
107
108
109
110
111

112
113
114
115
116
117
118
119
104
105
106
107
108
109
110

111

112
113
114
115
116
117
118







-
+
-







extern Class objc_lookup_class(const char*);
extern const char* class_getName(Class);
extern Class class_getSuperclass(Class);
extern BOOL class_isKindOfClass(Class, Class);
extern unsigned long class_getInstanceSize(Class);
extern BOOL class_respondsToSelector(Class, SEL);
extern BOOL class_conformsToProtocol(Class, Protocol*);
extern IMP objc_get_class_method(Class, SEL);
extern IMP class_getMethodImplementation(Class, SEL);
extern IMP objc_get_instance_method(Class, SEL);
extern IMP class_replaceMethod(Class, SEL, IMP, const char*);
extern const char* objc_get_type_encoding(Class, SEL);
extern IMP objc_msg_lookup(id, SEL);
extern void objc_thread_add(void);
extern void objc_thread_remove(void);
extern void objc_exit(void);
#endif