]> git.saurik.com Git - apple/objc4.git/blob - runtime/Messengers.subproj/objc-msg-arm.s
objc4-779.1.tar.gz
[apple/objc4.git] / runtime / Messengers.subproj / objc-msg-arm.s
1 /*
2 * @APPLE_LICENSE_HEADER_START@
3 *
4 * Copyright (c) 1999-2007 Apple Computer, Inc. All Rights Reserved.
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /********************************************************************
24 *
25 * objc-msg-arm.s - ARM code to support objc messaging
26 *
27 ********************************************************************/
28
29 #ifdef __arm__
30
31 #include <arm/arch.h>
32 #include "objc-config.h"
33 #include "isa.h"
34
35 #ifndef _ARM_ARCH_7
36 # error requires armv7
37 #endif
38
39 // Set FP=1 on architectures that pass parameters in floating-point registers
40 #if __ARM_ARCH_7K__
41 # define FP 1
42 #else
43 # define FP 0
44 #endif
45
46 #if FP
47
48 # if !__ARM_NEON__
49 # error sorry
50 # endif
51
52 # define FP_RETURN_ZERO \
53 vmov.i32 q0, #0 ; \
54 vmov.i32 q1, #0 ; \
55 vmov.i32 q2, #0 ; \
56 vmov.i32 q3, #0
57
58 # define FP_SAVE \
59 vpush {q0-q3}
60
61 # define FP_RESTORE \
62 vpop {q0-q3}
63
64 #else
65
66 # define FP_RETURN_ZERO
67 # define FP_SAVE
68 # define FP_RESTORE
69
70 #endif
71
72 .syntax unified
73
74 #define MI_EXTERN(var) \
75 .non_lazy_symbol_pointer ;\
76 L##var##$$non_lazy_ptr: ;\
77 .indirect_symbol var ;\
78 .long 0
79
80 #define MI_GET_EXTERN(reg,var) \
81 movw reg, :lower16:(L##var##$$non_lazy_ptr-7f-4) ;\
82 movt reg, :upper16:(L##var##$$non_lazy_ptr-7f-4) ;\
83 7: add reg, pc ;\
84 ldr reg, [reg]
85
86 #define MI_GET_ADDRESS(reg,var) \
87 movw reg, :lower16:(var-7f-4) ;\
88 movt reg, :upper16:(var-7f-4) ;\
89 7: add reg, pc ;\
90
91
92 .data
93
94 #if SUPPORT_INDEXED_ISA
95
96 .align 2
97 .globl _objc_indexed_classes
98 _objc_indexed_classes:
99 .fill ISA_INDEX_COUNT, 4, 0
100
101 #endif
102
103
104
105 // _objc_restartableRanges is used by method dispatch
106 // caching code to figure out whether any threads are actively
107 // in the cache for dispatching. The labels surround the asm code
108 // that do cache lookups. The tables are zero-terminated.
109
110 .macro RestartableEntry
111 .long LLookupStart$0
112 .long 0
113 .short LLookupEnd$0 - LLookupStart$0
114 .short 0xffff // poor ol' armv7 doesn't support kernel based recovery
115 .long 0
116 .endmacro
117
118 .align 4
119 .private_extern _objc_restartableRanges
120 _objc_restartableRanges:
121 RestartableEntry _cache_getImp
122 RestartableEntry _objc_msgSend
123 RestartableEntry _objc_msgSend_stret
124 RestartableEntry _objc_msgSendSuper
125 RestartableEntry _objc_msgSendSuper_stret
126 RestartableEntry _objc_msgSendSuper2
127 RestartableEntry _objc_msgSendSuper2_stret
128 RestartableEntry _objc_msgLookup
129 RestartableEntry _objc_msgLookup_stret
130 RestartableEntry _objc_msgLookupSuper2
131 RestartableEntry _objc_msgLookupSuper2_stret
132 .fill 16, 1, 0
133
134
135 /********************************************************************
136 * Names for relative labels
137 * DO NOT USE THESE LABELS ELSEWHERE
138 * Reserved labels: 6: 7: 8: 9:
139 ********************************************************************/
140 // 6: used by CacheLookup
141 // 7: used by MI_GET_ADDRESS etc
142 // 8: used by CacheLookup
143 #define LNilReceiver 9
144 #define LNilReceiver_f 9f
145 #define LNilReceiver_b 9b
146
147
148 /********************************************************************
149 * Macro parameters
150 ********************************************************************/
151
152 #define NORMAL 0
153 #define STRET 1
154
155
156 /********************************************************************
157 *
158 * Structure definitions.
159 *
160 ********************************************************************/
161
162 /* objc_super parameter to sendSuper */
163 #define RECEIVER 0
164 #define CLASS 4
165
166 /* Selected field offsets in class structure */
167 #define ISA 0
168 #define SUPERCLASS 4
169 #define CACHE 8
170 #define CACHE_MASK 12
171
172 /* Field offsets in method cache bucket */
173 #define CACHED_SEL 0
174 #define CACHED_IMP 4
175
176 /* Selected field offsets in method structure */
177 #define METHOD_NAME 0
178 #define METHOD_TYPES 4
179 #define METHOD_IMP 8
180
181
182 //////////////////////////////////////////////////////////////////////
183 //
184 // ENTRY functionName
185 //
186 // Assembly directives to begin an exported function.
187 //
188 // Takes: functionName - name of the exported function
189 //////////////////////////////////////////////////////////////////////
190
191 .macro ENTRY /* name */
192 .text
193 .thumb
194 .align 5
195 .globl $0
196 .thumb_func
197 $0:
198 .endmacro
199
200 .macro STATIC_ENTRY /*name*/
201 .text
202 .thumb
203 .align 5
204 .private_extern $0
205 .thumb_func
206 $0:
207 .endmacro
208
209
210 //////////////////////////////////////////////////////////////////////
211 //
212 // END_ENTRY functionName
213 //
214 // Assembly directives to end an exported function. Just a placeholder,
215 // a close-parenthesis for ENTRY, until it is needed for something.
216 //
217 // Takes: functionName - name of the exported function
218 //////////////////////////////////////////////////////////////////////
219
220 .macro END_ENTRY /* name */
221 LExit$0:
222 .endmacro
223
224
225 /////////////////////////////////////////////////////////////////////
226 //
227 // CacheLookup NORMAL|STRET <function>
228 // CacheLookup2 NORMAL|STRET <function>
229 //
230 // Locate the implementation for a selector in a class's method cache.
231 //
232 // Takes:
233 // $0 = NORMAL, STRET
234 // r0 or r1 (STRET) = receiver
235 // r1 or r2 (STRET) = selector
236 // r9 = class to search in
237 //
238 // On exit: r9 clobbered
239 // (found) continues after CacheLookup, IMP in r12, eq set
240 // (not found) continues after CacheLookup2
241 //
242 /////////////////////////////////////////////////////////////////////
243
244 .macro CacheLookup
245 //
246 // Restart protocol:
247 //
248 // As soon as we're past the LLookupStart$1 label we may have loaded
249 // an invalid cache pointer or mask.
250 //
251 // When task_restartable_ranges_synchronize() is called,
252 // (or when a signal hits us) before we're past LLookupEnd$1,
253 // then our PC will be reset to LCacheMiss$1 which forcefully
254 // jumps to the cache-miss codepath.
255 //
256 // It is assumed that the CacheMiss codepath starts right at the end
257 // of CacheLookup2 and will re-setup the registers to meet the cache-miss
258 // requirements:
259 //
260 // GETIMP:
261 // The cache-miss is just returning NULL (setting r9 to 0)
262 //
263 // NORMAL and STRET:
264 // - r0 or r1 (STRET) contains the receiver
265 // - r1 or r2 (STRET) contains the selector
266 // - r9 contains the isa (reloaded from r0/r1)
267 // - other registers are set as per calling conventions
268 //
269 LLookupStart$1:
270
271 ldrh r12, [r9, #CACHE_MASK] // r12 = mask
272 ldr r9, [r9, #CACHE] // r9 = buckets
273 .if $0 == STRET
274 and r12, r12, r2 // r12 = index = SEL & mask
275 .else
276 and r12, r12, r1 // r12 = index = SEL & mask
277 .endif
278 add r9, r9, r12, LSL #3 // r9 = bucket = buckets+index*8
279 ldr r12, [r9, #CACHED_SEL] // r12 = bucket->sel
280 6:
281 .if $0 == STRET
282 teq r12, r2
283 .else
284 teq r12, r1
285 .endif
286 bne 8f
287 ldr r12, [r9, #CACHED_IMP] // r12 = bucket->imp
288
289 .if $0 == STRET
290 tst r12, r12 // set ne for stret forwarding
291 .else
292 // eq already set for nonstret forwarding by `teq` above
293 .endif
294
295 .endmacro
296
297 .macro CacheLookup2
298 #if CACHED_SEL != 0
299 # error this code requires that SEL be at offset 0
300 #endif
301 8:
302 cmp r12, #1
303 blo LCacheMiss$1 // if (bucket->sel == 0) cache miss
304 it eq // if (bucket->sel == 1) cache wrap
305 ldreq r9, [r9, #CACHED_IMP] // bucket->imp is before first bucket
306 ldr r12, [r9, #8]! // r12 = (++bucket)->sel
307 b 6b
308
309 LLookupEnd$1:
310 LCacheMiss$1:
311
312 .endmacro
313
314 /////////////////////////////////////////////////////////////////////
315 //
316 // GetClassFromIsa return-type
317 //
318 // Given an Isa, return the class for the Isa.
319 //
320 // Takes:
321 // r9 = class
322 //
323 // On exit: r12 clobbered
324 // r9 contains the class for this Isa.
325 //
326 /////////////////////////////////////////////////////////////////////
327 .macro GetClassFromIsa
328
329 #if SUPPORT_INDEXED_ISA
330 // Note: We are doing a little wasted work here to load values we might not
331 // need. Branching turns out to be even worse when performance was measured.
332 MI_GET_ADDRESS(r12, _objc_indexed_classes)
333 tst.w r9, #ISA_INDEX_IS_NPI_MASK
334 itt ne
335 ubfxne r9, r9, #ISA_INDEX_SHIFT, #ISA_INDEX_BITS
336 ldrne.w r9, [r12, r9, lsl #2]
337 #endif
338
339 .endmacro
340
341
342 /********************************************************************
343 * IMP cache_getImp(Class cls, SEL sel)
344 *
345 * On entry: r0 = class whose cache is to be searched
346 * r1 = selector to search for
347 *
348 * If found, returns method implementation.
349 * If not found, returns NULL.
350 ********************************************************************/
351
352 STATIC_ENTRY _cache_getImp
353
354 mov r9, r0
355 CacheLookup NORMAL, _cache_getImp
356 // cache hit, IMP in r12
357 mov r0, r12
358 bx lr // return imp
359
360 CacheLookup2 GETIMP, _cache_getImp
361 // cache miss, return nil
362 mov r0, #0
363 bx lr
364
365 END_ENTRY _cache_getImp
366
367
368 /********************************************************************
369 *
370 * id objc_msgSend(id self, SEL _cmd, ...);
371 * IMP objc_msgLookup(id self, SEL _cmd, ...);
372 *
373 * objc_msgLookup ABI:
374 * IMP returned in r12
375 * Forwarding returned in Z flag
376 * r9 reserved for our use but not used
377 *
378 ********************************************************************/
379
380 ENTRY _objc_msgSend
381
382 cbz r0, LNilReceiver_f
383
384 ldr r9, [r0] // r9 = self->isa
385 GetClassFromIsa // r9 = class
386 CacheLookup NORMAL, _objc_msgSend
387 // cache hit, IMP in r12, eq already set for nonstret forwarding
388 bx r12 // call imp
389
390 CacheLookup2 NORMAL, _objc_msgSend
391 // cache miss
392 ldr r9, [r0] // r9 = self->isa
393 GetClassFromIsa // r9 = class
394 b __objc_msgSend_uncached
395
396 LNilReceiver:
397 // r0 is already zero
398 mov r1, #0
399 mov r2, #0
400 mov r3, #0
401 FP_RETURN_ZERO
402 bx lr
403
404 END_ENTRY _objc_msgSend
405
406
407 ENTRY _objc_msgLookup
408
409 cbz r0, LNilReceiver_f
410
411 ldr r9, [r0] // r9 = self->isa
412 GetClassFromIsa // r9 = class
413 CacheLookup NORMAL, _objc_msgLookup
414 // cache hit, IMP in r12, eq already set for nonstret forwarding
415 bx lr
416
417 CacheLookup2 NORMAL, _objc_msgLookup
418 // cache miss
419 ldr r9, [r0] // r9 = self->isa
420 GetClassFromIsa // r9 = class
421 b __objc_msgLookup_uncached
422
423 LNilReceiver:
424 MI_GET_ADDRESS(r12, __objc_msgNil)
425 bx lr
426
427 END_ENTRY _objc_msgLookup
428
429
430 STATIC_ENTRY __objc_msgNil
431
432 // r0 is already zero
433 mov r1, #0
434 mov r2, #0
435 mov r3, #0
436 FP_RETURN_ZERO
437 bx lr
438
439 END_ENTRY __objc_msgNil
440
441
442 /********************************************************************
443 * void objc_msgSend_stret(void *st_addr, id self, SEL op, ...);
444 * IMP objc_msgLookup_stret(void *st_addr, id self, SEL op, ...);
445 *
446 * objc_msgSend_stret is the struct-return form of msgSend.
447 * The ABI calls for r0 to be used as the address of the structure
448 * being returned, with the parameters in the succeeding registers.
449 *
450 * On entry: r0 is the address where the structure is returned,
451 * r1 is the message receiver,
452 * r2 is the selector
453 ********************************************************************/
454
455 ENTRY _objc_msgSend_stret
456
457 cbz r1, LNilReceiver_f
458
459 ldr r9, [r1] // r9 = self->isa
460 GetClassFromIsa // r9 = class
461 CacheLookup STRET, _objc_msgSend_stret
462 // cache hit, IMP in r12, ne already set for stret forwarding
463 bx r12
464
465 CacheLookup2 STRET, _objc_msgSend_stret
466 // cache miss
467 ldr r9, [r1] // r9 = self->isa
468 GetClassFromIsa // r9 = class
469 b __objc_msgSend_stret_uncached
470
471 LNilReceiver:
472 bx lr
473
474 END_ENTRY _objc_msgSend_stret
475
476
477 ENTRY _objc_msgLookup_stret
478
479 cbz r1, LNilReceiver_f
480
481 ldr r9, [r1] // r9 = self->isa
482 GetClassFromIsa // r9 = class
483 CacheLookup STRET, _objc_msgLookup_stret
484 // cache hit, IMP in r12, ne already set for stret forwarding
485 bx lr
486
487 CacheLookup2 STRET, _objc_msgLookup_stret
488 // cache miss
489 ldr r9, [r1] // r9 = self->isa
490 GetClassFromIsa // r9 = class
491 b __objc_msgLookup_stret_uncached
492
493 LNilReceiver:
494 MI_GET_ADDRESS(r12, __objc_msgNil_stret)
495 bx lr
496
497 END_ENTRY _objc_msgLookup_stret
498
499
500 STATIC_ENTRY __objc_msgNil_stret
501
502 bx lr
503
504 END_ENTRY __objc_msgNil_stret
505
506
507 /********************************************************************
508 * id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
509 *
510 * struct objc_super {
511 * id receiver;
512 * Class cls; // the class to search
513 * }
514 ********************************************************************/
515
516 ENTRY _objc_msgSendSuper
517
518 ldr r9, [r0, #CLASS] // r9 = struct super->class
519 CacheLookup NORMAL, _objc_msgSendSuper
520 // cache hit, IMP in r12, eq already set for nonstret forwarding
521 ldr r0, [r0, #RECEIVER] // load real receiver
522 bx r12 // call imp
523
524 CacheLookup2 NORMAL, _objc_msgSendSuper
525 // cache miss
526 ldr r9, [r0, #CLASS] // r9 = struct super->class
527 ldr r0, [r0, #RECEIVER] // load real receiver
528 b __objc_msgSend_uncached
529
530 END_ENTRY _objc_msgSendSuper
531
532
533 /********************************************************************
534 * id objc_msgSendSuper2(struct objc_super *super, SEL op, ...)
535 *
536 * struct objc_super {
537 * id receiver;
538 * Class cls; // SUBCLASS of the class to search
539 * }
540 ********************************************************************/
541
542 ENTRY _objc_msgSendSuper2
543
544 ldr r9, [r0, #CLASS] // class = struct super->class
545 ldr r9, [r9, #SUPERCLASS] // class = class->superclass
546 CacheLookup NORMAL, _objc_msgSendSuper2
547 // cache hit, IMP in r12, eq already set for nonstret forwarding
548 ldr r0, [r0, #RECEIVER] // load real receiver
549 bx r12 // call imp
550
551 CacheLookup2 NORMAL, _objc_msgSendSuper2
552 // cache miss
553 ldr r9, [r0, #CLASS] // class = struct super->class
554 ldr r9, [r9, #SUPERCLASS] // class = class->superclass
555 ldr r0, [r0, #RECEIVER] // load real receiver
556 b __objc_msgSend_uncached
557
558 END_ENTRY _objc_msgSendSuper2
559
560
561 ENTRY _objc_msgLookupSuper2
562
563 ldr r9, [r0, #CLASS] // class = struct super->class
564 ldr r9, [r9, #SUPERCLASS] // class = class->superclass
565 CacheLookup NORMAL, _objc_msgLookupSuper2
566 // cache hit, IMP in r12, eq already set for nonstret forwarding
567 ldr r0, [r0, #RECEIVER] // load real receiver
568 bx lr
569
570 CacheLookup2 NORMAL, _objc_msgLookupSuper2
571 // cache miss
572 ldr r9, [r0, #CLASS]
573 ldr r9, [r9, #SUPERCLASS] // r9 = class to search
574 ldr r0, [r0, #RECEIVER] // load real receiver
575 b __objc_msgLookup_uncached
576
577 END_ENTRY _objc_msgLookupSuper2
578
579
580 /********************************************************************
581 * void objc_msgSendSuper_stret(void *st_addr, objc_super *self, SEL op, ...);
582 *
583 * objc_msgSendSuper_stret is the struct-return form of msgSendSuper.
584 * The ABI calls for r0 to be used as the address of the structure
585 * being returned, with the parameters in the succeeding registers.
586 *
587 * On entry: r0 is the address where the structure is returned,
588 * r1 is the address of the objc_super structure,
589 * r2 is the selector
590 ********************************************************************/
591
592 ENTRY _objc_msgSendSuper_stret
593
594 ldr r9, [r1, #CLASS] // r9 = struct super->class
595 CacheLookup STRET, _objc_msgSendSuper_stret
596 // cache hit, IMP in r12, ne already set for stret forwarding
597 ldr r1, [r1, #RECEIVER] // load real receiver
598 bx r12 // call imp
599
600 CacheLookup2 STRET, _objc_msgSendSuper_stret
601 // cache miss
602 ldr r9, [r1, #CLASS] // r9 = struct super->class
603 ldr r1, [r1, #RECEIVER] // load real receiver
604 b __objc_msgSend_stret_uncached
605
606 END_ENTRY _objc_msgSendSuper_stret
607
608
609 /********************************************************************
610 * id objc_msgSendSuper2_stret
611 ********************************************************************/
612
613 ENTRY _objc_msgSendSuper2_stret
614
615 ldr r9, [r1, #CLASS] // class = struct super->class
616 ldr r9, [r9, #SUPERCLASS] // class = class->superclass
617 CacheLookup STRET, _objc_msgSendSuper2_stret
618 // cache hit, IMP in r12, ne already set for stret forwarding
619 ldr r1, [r1, #RECEIVER] // load real receiver
620 bx r12 // call imp
621
622 CacheLookup2 STRET, _objc_msgSendSuper2_stret
623 // cache miss
624 ldr r9, [r1, #CLASS] // class = struct super->class
625 ldr r9, [r9, #SUPERCLASS] // class = class->superclass
626 ldr r1, [r1, #RECEIVER] // load real receiver
627 b __objc_msgSend_stret_uncached
628
629 END_ENTRY _objc_msgSendSuper2_stret
630
631
632 ENTRY _objc_msgLookupSuper2_stret
633
634 ldr r9, [r1, #CLASS] // class = struct super->class
635 ldr r9, [r9, #SUPERCLASS] // class = class->superclass
636 CacheLookup STRET, _objc_msgLookupSuper2_stret
637 // cache hit, IMP in r12, ne already set for stret forwarding
638 ldr r1, [r1, #RECEIVER] // load real receiver
639 bx lr
640
641 CacheLookup2 STRET, _objc_msgLookupSuper2_stret
642 // cache miss
643 ldr r9, [r1, #CLASS]
644 ldr r9, [r9, #SUPERCLASS] // r9 = class to search
645 ldr r1, [r1, #RECEIVER] // load real receiver
646 b __objc_msgLookup_stret_uncached
647
648 END_ENTRY _objc_msgLookupSuper2_stret
649
650
651 /////////////////////////////////////////////////////////////////////
652 //
653 // MethodTableLookup NORMAL|STRET
654 //
655 // Locate the implementation for a selector in a class's method lists.
656 //
657 // Takes:
658 // $0 = NORMAL, STRET
659 // r0 or r1 (STRET) = receiver
660 // r1 or r2 (STRET) = selector
661 // r9 = class to search in
662 //
663 // On exit: IMP in r12, eq/ne set for forwarding
664 //
665 /////////////////////////////////////////////////////////////////////
666
667 .macro MethodTableLookup
668
669 stmfd sp!, {r0-r3,r7,lr}
670 add r7, sp, #16
671 sub sp, #8 // align stack
672 FP_SAVE
673
674 // lookUpImpOrForward(obj, sel, cls, LOOKUP_INITIALIZE | LOOKUP_RESOLVER)
675 .if $0 == NORMAL
676 // receiver already in r0
677 // selector already in r1
678 .else
679 mov r0, r1 // receiver
680 mov r1, r2 // selector
681 .endif
682 mov r2, r9 // class to search
683 mov r3, #3 // LOOKUP_INITIALIZE | LOOKUP_INITIALIZE
684 blx _lookUpImpOrForward
685 mov r12, r0 // r12 = IMP
686
687 .if $0 == NORMAL
688 cmp r12, r12 // set eq for nonstret forwarding
689 .else
690 tst r12, r12 // set ne for stret forwarding
691 .endif
692
693 FP_RESTORE
694 add sp, #8 // align stack
695 ldmfd sp!, {r0-r3,r7,lr}
696
697 .endmacro
698
699
700 /********************************************************************
701 *
702 * _objc_msgSend_uncached
703 * _objc_msgSend_stret_uncached
704 * _objc_msgLookup_uncached
705 * _objc_msgLookup_stret_uncached
706 * The uncached method lookup.
707 *
708 ********************************************************************/
709
710 STATIC_ENTRY __objc_msgSend_uncached
711
712 // THIS IS NOT A CALLABLE C FUNCTION
713 // Out-of-band r9 is the class to search
714
715 MethodTableLookup NORMAL // returns IMP in r12
716 bx r12
717
718 END_ENTRY __objc_msgSend_uncached
719
720
721 STATIC_ENTRY __objc_msgSend_stret_uncached
722
723 // THIS IS NOT A CALLABLE C FUNCTION
724 // Out-of-band r9 is the class to search
725
726 MethodTableLookup STRET // returns IMP in r12
727 bx r12
728
729 END_ENTRY __objc_msgSend_stret_uncached
730
731
732 STATIC_ENTRY __objc_msgLookup_uncached
733
734 // THIS IS NOT A CALLABLE C FUNCTION
735 // Out-of-band r9 is the class to search
736
737 MethodTableLookup NORMAL // returns IMP in r12
738 bx lr
739
740 END_ENTRY __objc_msgLookup_uncached
741
742
743 STATIC_ENTRY __objc_msgLookup_stret_uncached
744
745 // THIS IS NOT A CALLABLE C FUNCTION
746 // Out-of-band r9 is the class to search
747
748 MethodTableLookup STRET // returns IMP in r12
749 bx lr
750
751 END_ENTRY __objc_msgLookup_stret_uncached
752
753
754 /********************************************************************
755 *
756 * id _objc_msgForward(id self, SEL _cmd,...);
757 *
758 * _objc_msgForward and _objc_msgForward_stret are the externally-callable
759 * functions returned by things like method_getImplementation().
760 * _objc_msgForward_impcache is the function pointer actually stored in
761 * method caches.
762 *
763 ********************************************************************/
764
765 MI_EXTERN(__objc_forward_handler)
766 MI_EXTERN(__objc_forward_stret_handler)
767
768 STATIC_ENTRY __objc_msgForward_impcache
769 // Method cache version
770
771 // THIS IS NOT A CALLABLE C FUNCTION
772 // Out-of-band Z is 0 (EQ) for normal, 1 (NE) for stret
773
774 beq __objc_msgForward
775 b __objc_msgForward_stret
776
777 END_ENTRY __objc_msgForward_impcache
778
779
780 ENTRY __objc_msgForward
781 // Non-stret version
782
783 MI_GET_EXTERN(r12, __objc_forward_handler)
784 ldr r12, [r12]
785 bx r12
786
787 END_ENTRY __objc_msgForward
788
789
790 ENTRY __objc_msgForward_stret
791 // Struct-return version
792
793 MI_GET_EXTERN(r12, __objc_forward_stret_handler)
794 ldr r12, [r12]
795 bx r12
796
797 END_ENTRY __objc_msgForward_stret
798
799
800 ENTRY _objc_msgSend_noarg
801 b _objc_msgSend
802 END_ENTRY _objc_msgSend_noarg
803
804 ENTRY _objc_msgSend_debug
805 b _objc_msgSend
806 END_ENTRY _objc_msgSend_debug
807
808 ENTRY _objc_msgSendSuper2_debug
809 b _objc_msgSendSuper2
810 END_ENTRY _objc_msgSendSuper2_debug
811
812 ENTRY _objc_msgSend_stret_debug
813 b _objc_msgSend_stret
814 END_ENTRY _objc_msgSend_stret_debug
815
816 ENTRY _objc_msgSendSuper2_stret_debug
817 b _objc_msgSendSuper2_stret
818 END_ENTRY _objc_msgSendSuper2_stret_debug
819
820
821 ENTRY _method_invoke
822 // r1 is method triplet instead of SEL
823 ldr r12, [r1, #METHOD_IMP]
824 ldr r1, [r1, #METHOD_NAME]
825 bx r12
826 END_ENTRY _method_invoke
827
828
829 ENTRY _method_invoke_stret
830 // r2 is method triplet instead of SEL
831 ldr r12, [r2, #METHOD_IMP]
832 ldr r2, [r2, #METHOD_NAME]
833 bx r12
834 END_ENTRY _method_invoke_stret
835
836
837 .section __DATA,__objc_msg_break
838 .long 0
839 .long 0
840
841 #endif