2 * Copyright (c) 1999-2007 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 #include <TargetConditionals.h>
25 #if __x86_64__ && TARGET_OS_SIMULATOR
27 /********************************************************************
28 ********************************************************************
30 ** objc-msg-x86_64.s - x86-64 code to support objc messaging.
32 ********************************************************************
33 ********************************************************************/
37 // _objc_entryPoints and _objc_exitPoints are used by objc
38 // to get the critical regions for which method caches
39 // cannot be garbage collected.
42 .private_extern _objc_entryPoints
46 .quad _objc_msgSend_fpret
47 .quad _objc_msgSend_fp2ret
48 .quad _objc_msgSend_stret
49 .quad _objc_msgSendSuper
50 .quad _objc_msgSendSuper_stret
51 .quad _objc_msgSendSuper2
52 .quad _objc_msgSendSuper2_stret
54 .quad _objc_msgLookup_fpret
55 .quad _objc_msgLookup_fp2ret
56 .quad _objc_msgLookup_stret
57 .quad _objc_msgLookupSuper2
58 .quad _objc_msgLookupSuper2_stret
61 .private_extern _objc_exitPoints
63 .quad LExit_cache_getImp
64 .quad LExit_objc_msgSend
65 .quad LExit_objc_msgSend_fpret
66 .quad LExit_objc_msgSend_fp2ret
67 .quad LExit_objc_msgSend_stret
68 .quad LExit_objc_msgSendSuper
69 .quad LExit_objc_msgSendSuper_stret
70 .quad LExit_objc_msgSendSuper2
71 .quad LExit_objc_msgSendSuper2_stret
72 .quad LExit_objc_msgLookup
73 .quad LExit_objc_msgLookup_fpret
74 .quad LExit_objc_msgLookup_fp2ret
75 .quad LExit_objc_msgLookup_stret
76 .quad LExit_objc_msgLookupSuper2
77 .quad LExit_objc_msgLookupSuper2_stret
81 /********************************************************************
82 * List every exit insn from every messenger for debugger use.
85 * 1 word instruction's address
86 * 1 word type (ENTER or FAST_EXIT or SLOW_EXIT or NIL_EXIT)
90 * ENTER is the start of a dispatcher
91 * FAST_EXIT is method dispatch
92 * SLOW_EXIT is uncached method lookup
93 * NIL_EXIT is returning zero from a message sent to nil
94 * These must match objc-gdb.h.
95 ********************************************************************/
102 .section __DATA,__objc_msg_break
103 .globl _gdb_objc_messenger_breakpoints
104 _gdb_objc_messenger_breakpoints:
105 // contents populated by the macros below
107 .macro MESSENGER_START
109 .section __DATA,__objc_msg_break
114 .macro MESSENGER_END_FAST
116 .section __DATA,__objc_msg_break
121 .macro MESSENGER_END_SLOW
123 .section __DATA,__objc_msg_break
128 .macro MESSENGER_END_NIL
130 .section __DATA,__objc_msg_break
137 /********************************************************************
138 * Recommended multi-byte NOP instructions
139 * (Intel 64 and IA-32 Architectures Software Developer's Manual Volume 2B)
140 ********************************************************************/
141 #define nop1 .byte 0x90
142 #define nop2 .byte 0x66,0x90
143 #define nop3 .byte 0x0F,0x1F,0x00
144 #define nop4 .byte 0x0F,0x1F,0x40,0x00
145 #define nop5 .byte 0x0F,0x1F,0x44,0x00,0x00
146 #define nop6 .byte 0x66,0x0F,0x1F,0x44,0x00,0x00
147 #define nop7 .byte 0x0F,0x1F,0x80,0x00,0x00,0x00,0x00
148 #define nop8 .byte 0x0F,0x1F,0x84,0x00,0x00,0x00,0x00,0x00
149 #define nop9 .byte 0x66,0x0F,0x1F,0x84,0x00,0x00,0x00,0x00,0x00
152 /********************************************************************
153 * Names for parameter registers.
154 ********************************************************************/
172 /********************************************************************
173 * Names for relative labels
174 * DO NOT USE THESE LABELS ELSEWHERE
175 * Reserved labels: 6: 7: 8: 9:
176 ********************************************************************/
178 #define LCacheMiss_f 6f
179 #define LCacheMiss_b 6b
180 #define LGetIsaDone 7
181 #define LGetIsaDone_f 7f
182 #define LGetIsaDone_b 7b
183 #define LNilOrTagged 8
184 #define LNilOrTagged_f 8f
185 #define LNilOrTagged_b 8b
190 /********************************************************************
192 ********************************************************************/
204 /********************************************************************
206 * Structure definitions.
208 ********************************************************************/
210 // objc_super parameter to sendSuper
214 // Selected field offsets in class structure
215 // #define isa 0 USE GetIsa INSTEAD
218 #define method_name 0
219 #define method_imp 16
222 //////////////////////////////////////////////////////////////////////
224 // ENTRY functionName
226 // Assembly directives to begin an exported function.
228 // Takes: functionName - name of the exported function
229 //////////////////////////////////////////////////////////////////////
245 //////////////////////////////////////////////////////////////////////
247 // END_ENTRY functionName
249 // Assembly directives to end an exported function. Just a placeholder,
250 // a close-parenthesis for ENTRY, until it is needed for something.
252 // Takes: functionName - name of the exported function
253 //////////////////////////////////////////////////////////////////////
260 /********************************************************************
262 * Unwind info generation
263 ********************************************************************/
265 .section __LD,__compact_unwind,regular,debug
267 .set LUnwind$0, LExit$0 - $0
270 .quad 0 /* no personality */
271 .quad 0 /* no LSDA */
275 #define NoFrame 0x02010000 // no frame, no SP adjustment except return address
276 #define FrameWithNoSaves 0x01000000 // frame, no non-volatile saves
279 /////////////////////////////////////////////////////////////////////
281 // CacheLookup return-type, caller
283 // Locate the implementation for a class in a selector's method cache.
286 // $0 = NORMAL, FPRET, FP2RET, STRET
287 // $1 = CALL, LOOKUP, GETIMP
288 // a1 or a2 (STRET) = receiver
289 // a2 or a3 (STRET) = selector
290 // r10 = class to search
292 // On exit: r10 clobbered
293 // (found) calls or returns IMP in r11, eq/ne set for forwarding
294 // (not found) jumps to LCacheMiss, class still in r10
296 /////////////////////////////////////////////////////////////////////
300 // CacheHit must always be preceded by a not-taken `jne` instruction
301 // in order to set the correct flags for _objc_msgForward_impcache.
303 // r11 = found bucket
306 movq 8(%r11), %rax // return imp
312 // eq already set for forwarding by `jne`
314 test %r11, %r11 // set ne for stret forwarding
319 jmp *8(%r11) // call imp
322 movq 8(%r11), %r11 // return imp
336 movq %a2, %r11 // r11 = _cmd
338 movq %a3, %r11 // r11 = _cmd
340 andl 24(%r10), %r11d // r11 = _cmd & class->cache.mask
341 shlq $$4, %r11 // r11 = offset = (_cmd & mask)<<4
342 addq 16(%r10), %r11 // r11 = class->cache.buckets + offset
345 cmpq (%r11), %a2 // if (bucket->sel != _cmd)
347 cmpq (%r11), %a3 // if (bucket->sel != _cmd)
350 // CacheHit must always be preceded by a not-taken `jne` instruction
351 CacheHit $0, $1 // call or return imp
356 jbe 3f // if (bucket->sel <= 1) wrap or miss
358 addq $$16, %r11 // bucket++
361 cmpq (%r11), %a2 // if (bucket->sel != _cmd)
363 cmpq (%r11), %a3 // if (bucket->sel != _cmd)
366 // CacheHit must always be preceded by a not-taken `jne` instruction
367 CacheHit $0, $1 // call or return imp
371 jb LCacheMiss_f // if (bucket->sel < 1) cache miss
373 movq 8(%r11), %r11 // bucket->imp is really first bucket
376 // Clone scanning loop to miss instead of hang when cache is corrupt.
377 // The slow path may detect any corruption and halt later.
382 jbe 3f // if (bucket->sel <= 1) wrap or miss
384 addq $$16, %r11 // bucket++
387 cmpq (%r11), %a2 // if (bucket->sel != _cmd)
389 cmpq (%r11), %a3 // if (bucket->sel != _cmd)
392 // CacheHit must always be preceded by a not-taken `jne` instruction
393 CacheHit $0, $1 // call or return imp
396 // double wrap or miss
402 /////////////////////////////////////////////////////////////////////
404 // MethodTableLookup NORMAL|STRET
406 // Takes: a1 or a2 (STRET) = receiver
407 // a2 or a3 (STRET) = selector to search for
408 // r10 = class to search
410 // On exit: imp in %r11, eq/ne set for forwarding
412 /////////////////////////////////////////////////////////////////////
414 .macro MethodTableLookup
419 sub $$0x80+8, %rsp // +8 for alignment
421 movdqa %xmm0, -0x80(%rbp)
422 push %rax // might be xmm parameter count
423 movdqa %xmm1, -0x70(%rbp)
425 movdqa %xmm2, -0x60(%rbp)
427 movdqa %xmm3, -0x50(%rbp)
429 movdqa %xmm4, -0x40(%rbp)
431 movdqa %xmm5, -0x30(%rbp)
433 movdqa %xmm6, -0x20(%rbp)
435 movdqa %xmm7, -0x10(%rbp)
437 // _class_lookupMethodAndLoadCache3(receiver, selector, class)
440 // receiver already in a1
441 // selector already in a2
447 call __class_lookupMethodAndLoadCache3
449 // IMP is now in %rax
452 movdqa -0x80(%rbp), %xmm0
454 movdqa -0x70(%rbp), %xmm1
456 movdqa -0x60(%rbp), %xmm2
458 movdqa -0x50(%rbp), %xmm3
460 movdqa -0x40(%rbp), %xmm4
462 movdqa -0x30(%rbp), %xmm5
464 movdqa -0x20(%rbp), %xmm6
466 movdqa -0x10(%rbp), %xmm7
469 cmp %r11, %r11 // set eq for nonstret forwarding
471 test %r11, %r11 // set ne for stret forwarding
479 /////////////////////////////////////////////////////////////////////
481 // GetIsaCheckNil return-type
482 // GetIsaSupport return-type
483 // NilTestReturnZero return-type
484 // NilTestReturnIMP return-type
486 // Sets r10 = obj->isa.
487 // Looks up the real class if receiver is a tagged pointer object.
488 // Returns zero or a zero-returning IMP if obj is nil.
490 // Takes: $0 = NORMAL or FPRET or FP2RET or STRET
491 // a1 or a2 (STRET) = receiver
493 // On exit from GetIsaCheckNil:
494 // r10 = receiver->isa
497 /////////////////////////////////////////////////////////////////////
506 .macro ZeroReturnFPRET
511 .macro ZeroReturnFP2RET
517 .macro ZeroReturnSTRET
518 // rax gets the struct-return address as passed in rdi
522 STATIC_ENTRY __objc_msgNil
525 END_ENTRY __objc_msgNil
527 STATIC_ENTRY __objc_msgNil_fpret
530 END_ENTRY __objc_msgNil_fpret
532 STATIC_ENTRY __objc_msgNil_fp2ret
535 END_ENTRY __objc_msgNil_fp2ret
537 STATIC_ENTRY __objc_msgNil_stret
540 END_ENTRY __objc_msgNil_stret
543 .macro GetIsaCheckNil
549 jle LNilOrTagged_f // MSB tagged pointer looks negative
552 movq (%a1), %r10 // r10 = isa
554 movq (%a2), %r10 // r10 = isa
564 jz LNil_f // flags set by GetIsaCheckNil
574 leaq _objc_debug_taggedpointer_classes(%rip), %r10
575 movq (%r10, %r11, 8), %r10 // read isa from table
586 leaq _objc_debug_taggedpointer_ext_classes(%rip), %r10
587 movq (%r10, %r11, 8), %r10 // read isa from table
592 .macro NilTestReturnZero
610 .macro NilTestReturnIMP
613 leaq __objc_msgNil(%rip), %r11
615 leaq __objc_msgNil_fpret(%rip), %r11
617 leaq __objc_msgNil_fp2ret(%rip), %r11
619 leaq __objc_msgNil_stret(%rip), %r11
627 /********************************************************************
628 * IMP cache_getImp(Class cls, SEL sel)
630 * On entry: a1 = class whose cache is to be searched
631 * a2 = selector to search for
633 * If found, returns method implementation.
634 * If not found, returns NULL.
635 ********************************************************************/
637 STATIC_ENTRY _cache_getImp
640 movq %a1, %r10 // move class to r10 for CacheLookup
641 CacheLookup NORMAL, GETIMP // returns IMP on success
644 // cache miss, return nil
648 END_ENTRY _cache_getImp
651 /********************************************************************
653 * id objc_msgSend(id self, SEL _cmd,...);
654 * IMP objc_msgLookup(id self, SEL _cmd, ...);
656 * objc_msgLookup ABI:
657 * IMP returned in r11
658 * Forwarding returned in Z flag
659 * r10 reserved for our use but not used
661 ********************************************************************/
665 .globl _objc_debug_taggedpointer_classes
666 _objc_debug_taggedpointer_classes:
668 .globl _objc_debug_taggedpointer_ext_classes
669 _objc_debug_taggedpointer_ext_classes:
673 UNWIND _objc_msgSend, NoFrame
676 GetIsaCheckNil NORMAL // r10 = self->isa, or return zero
677 CacheLookup NORMAL, CALL // calls IMP on success
680 NilTestReturnZero NORMAL
682 // cache miss: go search the method lists
686 jmp __objc_msgSend_uncached
688 END_ENTRY _objc_msgSend
691 ENTRY _objc_msgLookup
693 GetIsaCheckNil NORMAL // r10 = self->isa, or return zero IMP
694 CacheLookup NORMAL, LOOKUP // returns IMP on success
697 NilTestReturnIMP NORMAL
699 // cache miss: go search the method lists
702 jmp __objc_msgLookup_uncached
704 END_ENTRY _objc_msgLookup
707 ENTRY _objc_msgSend_fixup
709 END_ENTRY _objc_msgSend_fixup
712 STATIC_ENTRY _objc_msgSend_fixedup
713 // Load _cmd from the message_ref
716 END_ENTRY _objc_msgSend_fixedup
719 /********************************************************************
721 * id objc_msgSendSuper(struct objc_super *super, SEL _cmd,...);
723 * struct objc_super {
727 ********************************************************************/
729 ENTRY _objc_msgSendSuper
730 UNWIND _objc_msgSendSuper, NoFrame
733 // search the cache (objc_super in %a1)
734 movq class(%a1), %r10 // class = objc_super->class
735 movq receiver(%a1), %a1 // load real receiver
736 CacheLookup NORMAL, CALL // calls IMP on success
738 // cache miss: go search the method lists
740 // class still in r10
742 jmp __objc_msgSend_uncached
744 END_ENTRY _objc_msgSendSuper
747 /********************************************************************
748 * id objc_msgSendSuper2
749 ********************************************************************/
751 ENTRY _objc_msgSendSuper2
752 UNWIND _objc_msgSendSuper2, NoFrame
755 // objc_super->class is superclass of class to search
757 // search the cache (objc_super in %a1)
758 movq class(%a1), %r10 // cls = objc_super->class
759 movq receiver(%a1), %a1 // load real receiver
760 movq 8(%r10), %r10 // cls = class->superclass
761 CacheLookup NORMAL, CALL // calls IMP on success
763 // cache miss: go search the method lists
765 // superclass still in r10
767 jmp __objc_msgSend_uncached
769 END_ENTRY _objc_msgSendSuper2
772 ENTRY _objc_msgLookupSuper2
774 // objc_super->class is superclass of class to search
776 // search the cache (objc_super in %a1)
777 movq class(%a1), %r10 // cls = objc_super->class
778 movq receiver(%a1), %a1 // load real receiver
779 movq 8(%r10), %r10 // cls = class->superclass
780 CacheLookup NORMAL, LOOKUP // returns IMP on success
782 // cache miss: go search the method lists
784 // superclass still in r10
785 jmp __objc_msgLookup_uncached
787 END_ENTRY _objc_msgLookupSuper2
790 ENTRY _objc_msgSendSuper2_fixup
792 END_ENTRY _objc_msgSendSuper2_fixup
795 STATIC_ENTRY _objc_msgSendSuper2_fixedup
796 // Load _cmd from the message_ref
798 jmp _objc_msgSendSuper2
799 END_ENTRY _objc_msgSendSuper2_fixedup
802 /********************************************************************
804 * double objc_msgSend_fpret(id self, SEL _cmd,...);
805 * Used for `long double` return only. `float` and `double` use objc_msgSend.
807 ********************************************************************/
809 ENTRY _objc_msgSend_fpret
810 UNWIND _objc_msgSend_fpret, NoFrame
813 GetIsaCheckNil FPRET // r10 = self->isa, or return zero
814 CacheLookup FPRET, CALL // calls IMP on success
817 NilTestReturnZero FPRET
819 // cache miss: go search the method lists
823 jmp __objc_msgSend_uncached
825 END_ENTRY _objc_msgSend_fpret
828 ENTRY _objc_msgLookup_fpret
830 GetIsaCheckNil FPRET // r10 = self->isa, or return zero IMP
831 CacheLookup FPRET, LOOKUP // returns IMP on success
834 NilTestReturnIMP FPRET
836 // cache miss: go search the method lists
839 jmp __objc_msgLookup_uncached
841 END_ENTRY _objc_msgLookup_fpret
844 ENTRY _objc_msgSend_fpret_fixup
846 END_ENTRY _objc_msgSend_fpret_fixup
849 STATIC_ENTRY _objc_msgSend_fpret_fixedup
850 // Load _cmd from the message_ref
852 jmp _objc_msgSend_fpret
853 END_ENTRY _objc_msgSend_fpret_fixedup
856 /********************************************************************
858 * double objc_msgSend_fp2ret(id self, SEL _cmd,...);
859 * Used for `complex long double` return only.
861 ********************************************************************/
863 ENTRY _objc_msgSend_fp2ret
864 UNWIND _objc_msgSend_fp2ret, NoFrame
867 GetIsaCheckNil FP2RET // r10 = self->isa, or return zero
868 CacheLookup FP2RET, CALL // calls IMP on success
871 NilTestReturnZero FP2RET
873 // cache miss: go search the method lists
877 jmp __objc_msgSend_uncached
879 END_ENTRY _objc_msgSend_fp2ret
882 ENTRY _objc_msgLookup_fp2ret
884 GetIsaCheckNil FP2RET // r10 = self->isa, or return zero IMP
885 CacheLookup FP2RET, LOOKUP // returns IMP on success
888 NilTestReturnIMP FP2RET
890 // cache miss: go search the method lists
893 jmp __objc_msgLookup_uncached
895 END_ENTRY _objc_msgLookup_fp2ret
898 ENTRY _objc_msgSend_fp2ret_fixup
900 END_ENTRY _objc_msgSend_fp2ret_fixup
903 STATIC_ENTRY _objc_msgSend_fp2ret_fixedup
904 // Load _cmd from the message_ref
906 jmp _objc_msgSend_fp2ret
907 END_ENTRY _objc_msgSend_fp2ret_fixedup
910 /********************************************************************
912 * void objc_msgSend_stret(void *st_addr, id self, SEL _cmd, ...);
914 * objc_msgSend_stret is the struct-return form of msgSend.
915 * The ABI calls for %a1 to be used as the address of the structure
916 * being returned, with the parameters in the succeeding locations.
918 * On entry: %a1 is the address where the structure is returned,
919 * %a2 is the message receiver,
920 * %a3 is the selector
921 ********************************************************************/
923 ENTRY _objc_msgSend_stret
924 UNWIND _objc_msgSend_stret, NoFrame
927 GetIsaCheckNil STRET // r10 = self->isa, or return zero
928 CacheLookup STRET, CALL // calls IMP on success
931 NilTestReturnZero STRET
933 // cache miss: go search the method lists
937 jmp __objc_msgSend_stret_uncached
939 END_ENTRY _objc_msgSend_stret
942 ENTRY _objc_msgLookup_stret
944 GetIsaCheckNil STRET // r10 = self->isa, or return zero IMP
945 CacheLookup STRET, LOOKUP // returns IMP on success
948 NilTestReturnIMP STRET
950 // cache miss: go search the method lists
953 jmp __objc_msgLookup_stret_uncached
955 END_ENTRY _objc_msgLookup_stret
958 ENTRY _objc_msgSend_stret_fixup
960 END_ENTRY _objc_msgSend_stret_fixup
963 STATIC_ENTRY _objc_msgSend_stret_fixedup
964 // Load _cmd from the message_ref
966 jmp _objc_msgSend_stret
967 END_ENTRY _objc_msgSend_stret_fixedup
970 /********************************************************************
972 * void objc_msgSendSuper_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...);
974 * struct objc_super {
979 * objc_msgSendSuper_stret is the struct-return form of msgSendSuper.
980 * The ABI calls for (sp+4) to be used as the address of the structure
981 * being returned, with the parameters in the succeeding registers.
983 * On entry: %a1 is the address where the structure is returned,
984 * %a2 is the address of the objc_super structure,
985 * %a3 is the selector
987 ********************************************************************/
989 ENTRY _objc_msgSendSuper_stret
990 UNWIND _objc_msgSendSuper_stret, NoFrame
993 // search the cache (objc_super in %a2)
994 movq class(%a2), %r10 // class = objc_super->class
995 movq receiver(%a2), %a2 // load real receiver
996 CacheLookup STRET, CALL // calls IMP on success
998 // cache miss: go search the method lists
1000 // class still in r10
1002 jmp __objc_msgSend_stret_uncached
1004 END_ENTRY _objc_msgSendSuper_stret
1007 /********************************************************************
1008 * id objc_msgSendSuper2_stret
1009 ********************************************************************/
1011 ENTRY _objc_msgSendSuper2_stret
1012 UNWIND _objc_msgSendSuper2_stret, NoFrame
1015 // search the cache (objc_super in %a2)
1016 movq class(%a2), %r10 // class = objc_super->class
1017 movq receiver(%a2), %a2 // load real receiver
1018 movq 8(%r10), %r10 // class = class->superclass
1019 CacheLookup STRET, CALL // calls IMP on success
1021 // cache miss: go search the method lists
1023 // superclass still in r10
1025 jmp __objc_msgSend_stret_uncached
1027 END_ENTRY _objc_msgSendSuper2_stret
1030 ENTRY _objc_msgLookupSuper2_stret
1032 // search the cache (objc_super in %a2)
1033 movq class(%a2), %r10 // class = objc_super->class
1034 movq receiver(%a2), %a2 // load real receiver
1035 movq 8(%r10), %r10 // class = class->superclass
1036 CacheLookup STRET, LOOKUP // returns IMP on success
1038 // cache miss: go search the method lists
1040 // superclass still in r10
1041 jmp __objc_msgLookup_stret_uncached
1043 END_ENTRY _objc_msgLookupSuper2_stret
1046 ENTRY _objc_msgSendSuper2_stret_fixup
1048 END_ENTRY _objc_msgSendSuper2_stret_fixup
1051 STATIC_ENTRY _objc_msgSendSuper2_stret_fixedup
1052 // Load _cmd from the message_ref
1054 jmp _objc_msgSendSuper2_stret
1055 END_ENTRY _objc_msgSendSuper2_stret_fixedup
1058 /********************************************************************
1060 * _objc_msgSend_uncached
1061 * _objc_msgSend_stret_uncached
1062 * The uncached method lookup.
1064 ********************************************************************/
1066 STATIC_ENTRY __objc_msgSend_uncached
1067 UNWIND __objc_msgSend_uncached, FrameWithNoSaves
1069 // THIS IS NOT A CALLABLE C FUNCTION
1070 // Out-of-band r10 is the searched class
1072 // r10 is already the class to search
1073 MethodTableLookup NORMAL // r11 = IMP
1074 jmp *%r11 // goto *imp
1076 END_ENTRY __objc_msgSend_uncached
1079 STATIC_ENTRY __objc_msgSend_stret_uncached
1080 UNWIND __objc_msgSend_stret_uncached, FrameWithNoSaves
1082 // THIS IS NOT A CALLABLE C FUNCTION
1083 // Out-of-band r10 is the searched class
1085 // r10 is already the class to search
1086 MethodTableLookup STRET // r11 = IMP
1087 jmp *%r11 // goto *imp
1089 END_ENTRY __objc_msgSend_stret_uncached
1092 STATIC_ENTRY __objc_msgLookup_uncached
1093 UNWIND __objc_msgLookup_uncached, FrameWithNoSaves
1095 // THIS IS NOT A CALLABLE C FUNCTION
1096 // Out-of-band r10 is the searched class
1098 // r10 is already the class to search
1099 MethodTableLookup NORMAL // r11 = IMP
1102 END_ENTRY __objc_msgLookup_uncached
1105 STATIC_ENTRY __objc_msgLookup_stret_uncached
1106 UNWIND __objc_msgLookup_stret_uncached, FrameWithNoSaves
1108 // THIS IS NOT A CALLABLE C FUNCTION
1109 // Out-of-band r10 is the searched class
1111 // r10 is already the class to search
1112 MethodTableLookup STRET // r11 = IMP
1115 END_ENTRY __objc_msgLookup_stret_uncached
1118 /********************************************************************
1120 * id _objc_msgForward(id self, SEL _cmd,...);
1122 * _objc_msgForward and _objc_msgForward_stret are the externally-callable
1123 * functions returned by things like method_getImplementation().
1124 * _objc_msgForward_impcache is the function pointer actually stored in
1127 ********************************************************************/
1129 STATIC_ENTRY __objc_msgForward_impcache
1130 // Method cache version
1132 // THIS IS NOT A CALLABLE C FUNCTION
1133 // Out-of-band condition register is NE for stret, EQ otherwise.
1139 jne __objc_msgForward_stret
1140 jmp __objc_msgForward
1142 END_ENTRY __objc_msgForward_impcache
1145 ENTRY __objc_msgForward
1146 // Non-stret version
1148 movq __objc_forward_handler(%rip), %r11
1151 END_ENTRY __objc_msgForward
1154 ENTRY __objc_msgForward_stret
1155 // Struct-return version
1157 movq __objc_forward_stret_handler(%rip), %r11
1160 END_ENTRY __objc_msgForward_stret
1163 ENTRY _objc_msgSend_debug
1165 END_ENTRY _objc_msgSend_debug
1167 ENTRY _objc_msgSendSuper2_debug
1168 jmp _objc_msgSendSuper2
1169 END_ENTRY _objc_msgSendSuper2_debug
1171 ENTRY _objc_msgSend_stret_debug
1172 jmp _objc_msgSend_stret
1173 END_ENTRY _objc_msgSend_stret_debug
1175 ENTRY _objc_msgSendSuper2_stret_debug
1176 jmp _objc_msgSendSuper2_stret
1177 END_ENTRY _objc_msgSendSuper2_stret_debug
1179 ENTRY _objc_msgSend_fpret_debug
1180 jmp _objc_msgSend_fpret
1181 END_ENTRY _objc_msgSend_fpret_debug
1183 ENTRY _objc_msgSend_fp2ret_debug
1184 jmp _objc_msgSend_fp2ret
1185 END_ENTRY _objc_msgSend_fp2ret_debug
1188 ENTRY _objc_msgSend_noarg
1190 END_ENTRY _objc_msgSend_noarg
1193 ENTRY _method_invoke
1195 movq method_imp(%a2), %r11
1196 movq method_name(%a2), %a2
1199 END_ENTRY _method_invoke
1202 ENTRY _method_invoke_stret
1204 movq method_imp(%a3), %r11
1205 movq method_name(%a3), %a3
1208 END_ENTRY _method_invoke_stret
1211 .section __DATA,__objc_msg_break