ObjFW  Check-in [3dac86b429]

Overview
Comment:-[performSelector:]: Use the normal dispatch.

This has the advantage of being faster.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3dac86b429c1ca611906d83efc7619bae63dcc83d58188c093635cc82db7a2d4
User & Date: js on 2013-12-21 12:58:27
Other Links: manifest | tags
Context
2013-12-22
15:00
PLATFORMS.md: Add ARM64 to iOS. check-in: d4fef32ab3 user: js tags: trunk
2013-12-21
12:58
-[performSelector:]: Use the normal dispatch. check-in: 3dac86b429 user: js tags: trunk
01:55
PLATFORMS.md: Specify ABI for MIPS. check-in: c885c9b73d user: js tags: trunk
Changes

Modified src/OFArray.m from [0c3512457f] to [752e762054].

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
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







-
-
+









-
-
+
+








- (void)makeObjectsPerformSelector: (SEL)selector
{
	id *objects = [self objects];
	size_t i, count = [self count];

	for (i = 0; i < count; i++)
		((void(*)(id, SEL))[objects[i]
		    methodForSelector: selector])(objects[i], selector);
		[objects[i] performSelector: selector];
}

- (void)makeObjectsPerformSelector: (SEL)selector
			withObject: (id)object
{
	id *objects = [self objects];
	size_t i, count = [self count];

	for (i = 0; i < count; i++)
		((void(*)(id, SEL, id))[objects[i]
		    methodForSelector: selector])(objects[i], selector, object);
		[objects[i] performSelector: selector
				 withObject: object];
}

- (OFArray*)sortedArray
{
	OFMutableArray *new = [[self mutableCopy] autorelease];

	[new sort];

Modified src/OFObject.h from [6c65e9c570] to [16867a85cf].

32
33
34
35
36
37
38

39
40
41
42
43
44
45
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46







+







# import "runtime.h"
#else
# import <objc/objc.h>
#endif

#ifdef OF_APPLE_RUNTIME
# import <objc/runtime.h>
# import <objc/message.h>
#endif

#if defined(__GNUC__)
# define restrict __restrict__
#elif __STDC_VERSION__ < 199901L
# define restrict
#endif

Modified src/OFObject.m from [9bd5d20560] to [e741aba66a].

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
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







+
-
+

-
-
-
-
-

+
+
+





+

-
+

-
-
+
-
-
-
-
+
+
+






+

-
+

-
-
+
-
-
-
-
+
+
+







- (IMP)methodForSelector: (SEL)selector
{
	return class_getMethodImplementation(object_getClass(self), selector);
}

- (id)performSelector: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
	id (*imp)(id, SEL) = (id(*)(id, SEL))[self methodForSelector: selector];
	id (*imp)(id, SEL) = (id(*)(id, SEL))objc_msg_lookup(self, selector);

	if OF_UNLIKELY (imp == NULL) {
		[self doesNotRecognizeSelector: selector];
		abort();
	}

	return imp(self, selector);
#elif defined(OF_APPLE_RUNTIME)
	return objc_msgSend(self, selector);
#endif
}

- (id)performSelector: (SEL)selector
	   withObject: (id)object
{
#if defined(OF_OBJFW_RUNTIME)
	id (*imp)(id, SEL, id) =
	    (id(*)(id, SEL, id))[self methodForSelector: selector];
	    (id(*)(id, SEL, id))objc_msg_lookup(self, selector);

	if OF_UNLIKELY (imp == NULL) {
		[self doesNotRecognizeSelector: selector];
	return imp(self, selector, object);
		abort();
	}

	return imp(self, selector, object);
#elif defined(OF_APPLE_RUNTIME)
	return objc_msgSend(self, selector, object);
#endif
}

- (id)performSelector: (SEL)selector
	   withObject: (id)object1
	   withObject: (id)object2
{
#if defined(OF_OBJFW_RUNTIME)
	id (*imp)(id, SEL, id, id) =
	    (id(*)(id, SEL, id, id))[self methodForSelector: selector];
	    (id(*)(id, SEL, id, id))objc_msg_lookup(self, selector);

	if OF_UNLIKELY (imp == NULL) {
		[self doesNotRecognizeSelector: selector];
	return imp(self, selector, object1, object2);
		abort();
	}

	return imp(self, selector, object1, object2);
#elif defined(OF_APPLE_RUNTIME)
	return objc_msgSend(self, selector, object1, object2);
#endif
}

- (void)performSelector: (SEL)selector
	     afterDelay: (double)delay
{
	void *pool = objc_autoreleasePoolPush();