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 * Harmless branch prefix hint for instruction alignment
154 ********************************************************************/
156 #define PN .byte 0x2e
159 /********************************************************************
160 * Names for parameter registers.
161 ********************************************************************/
179 /********************************************************************
180 * Names for relative labels
181 * DO NOT USE THESE LABELS ELSEWHERE
182 * Reserved labels: 6: 7: 8: 9:
183 ********************************************************************/
185 #define LCacheMiss_f 6f
186 #define LCacheMiss_b 6b
187 #define LNilTestSlow 7
188 #define LNilTestSlow_f 7f
189 #define LNilTestSlow_b 7b
190 #define LGetIsaDone 8
191 #define LGetIsaDone_f 8f
192 #define LGetIsaDone_b 8b
193 #define LGetIsaSlow 9
194 #define LGetIsaSlow_f 9f
195 #define LGetIsaSlow_b 9b
197 /********************************************************************
199 ********************************************************************/
211 /********************************************************************
213 * Structure definitions.
215 ********************************************************************/
217 // objc_super parameter to sendSuper
221 // Selected field offsets in class structure
222 // #define isa 0 USE GetIsa INSTEAD
225 #define method_name 0
226 #define method_imp 16
229 //////////////////////////////////////////////////////////////////////
231 // ENTRY functionName
233 // Assembly directives to begin an exported function.
235 // Takes: functionName - name of the exported function
236 //////////////////////////////////////////////////////////////////////
252 //////////////////////////////////////////////////////////////////////
254 // END_ENTRY functionName
256 // Assembly directives to end an exported function. Just a placeholder,
257 // a close-parenthesis for ENTRY, until it is needed for something.
259 // Takes: functionName - name of the exported function
260 //////////////////////////////////////////////////////////////////////
267 /********************************************************************
269 * Unwind info generation
270 ********************************************************************/
272 .section __LD,__compact_unwind,regular,debug
274 .set LUnwind$0, LExit$0 - $0
277 .quad 0 /* no personality */
278 .quad 0 /* no LSDA */
282 #define NoFrame 0x02010000 // no frame, no SP adjustment except return address
283 #define FrameWithNoSaves 0x01000000 // frame, no non-volatile saves
286 /////////////////////////////////////////////////////////////////////
288 // CacheLookup return-type, caller
290 // Locate the implementation for a class in a selector's method cache.
293 // $0 = NORMAL, FPRET, FP2RET, STRET
294 // $1 = CALL, LOOKUP, GETIMP
295 // a1 or a2 (STRET) = receiver
296 // a2 or a3 (STRET) = selector
297 // r10 = class to search
299 // On exit: r10 clobbered
300 // (found) calls or returns IMP in r11, eq/ne set for forwarding
301 // (not found) jumps to LCacheMiss, class still in r10
303 /////////////////////////////////////////////////////////////////////
307 // CacheHit must always be preceded by a not-taken `jne` instruction
308 // in order to set the correct flags for _objc_msgForward_impcache.
310 // r11 = found bucket
313 movq 8(%r11), %rax // return imp
319 // eq already set for forwarding by `jne`
321 test %r11, %r11 // set ne for stret forwarding
326 jmp *8(%r11) // call imp
329 movq 8(%r11), %r11 // return imp
343 movq %a2, %r11 // r11 = _cmd
345 movq %a3, %r11 // r11 = _cmd
347 andl 24(%r10), %r11d // r11 = _cmd & class->cache.mask
348 shlq $$4, %r11 // r11 = offset = (_cmd & mask)<<4
349 addq 16(%r10), %r11 // r11 = class->cache.buckets + offset
352 cmpq (%r11), %a2 // if (bucket->sel != _cmd)
354 cmpq (%r11), %a3 // if (bucket->sel != _cmd)
357 // CacheHit must always be preceded by a not-taken `jne` instruction
358 CacheHit $0, $1 // call or return imp
363 jbe 3f // if (bucket->sel <= 1) wrap or miss
365 addq $$16, %r11 // bucket++
368 cmpq (%r11), %a2 // if (bucket->sel != _cmd)
370 cmpq (%r11), %a3 // if (bucket->sel != _cmd)
373 // CacheHit must always be preceded by a not-taken `jne` instruction
374 CacheHit $0, $1 // call or return imp
378 jb LCacheMiss_f // if (bucket->sel < 1) cache miss
380 movq 8(%r11), %r11 // bucket->imp is really first bucket
383 // Clone scanning loop to miss instead of hang when cache is corrupt.
384 // The slow path may detect any corruption and halt later.
389 jbe 3f // if (bucket->sel <= 1) wrap or miss
391 addq $$16, %r11 // bucket++
394 cmpq (%r11), %a2 // if (bucket->sel != _cmd)
396 cmpq (%r11), %a3 // if (bucket->sel != _cmd)
399 // CacheHit must always be preceded by a not-taken `jne` instruction
400 CacheHit $0, $1 // call or return imp
403 // double wrap or miss
409 /////////////////////////////////////////////////////////////////////
411 // MethodTableLookup NORMAL|STRET
413 // Takes: a1 or a2 (STRET) = receiver
414 // a2 or a3 (STRET) = selector to search for
415 // r10 = class to search
417 // On exit: imp in %r11, eq/ne set for forwarding
419 /////////////////////////////////////////////////////////////////////
421 .macro MethodTableLookup
426 sub $$0x80+8, %rsp // +8 for alignment
428 movdqa %xmm0, -0x80(%rbp)
429 push %rax // might be xmm parameter count
430 movdqa %xmm1, -0x70(%rbp)
432 movdqa %xmm2, -0x60(%rbp)
434 movdqa %xmm3, -0x50(%rbp)
436 movdqa %xmm4, -0x40(%rbp)
438 movdqa %xmm5, -0x30(%rbp)
440 movdqa %xmm6, -0x20(%rbp)
442 movdqa %xmm7, -0x10(%rbp)
444 // _class_lookupMethodAndLoadCache3(receiver, selector, class)
447 // receiver already in a1
448 // selector already in a2
454 call __class_lookupMethodAndLoadCache3
456 // IMP is now in %rax
459 movdqa -0x80(%rbp), %xmm0
461 movdqa -0x70(%rbp), %xmm1
463 movdqa -0x60(%rbp), %xmm2
465 movdqa -0x50(%rbp), %xmm3
467 movdqa -0x40(%rbp), %xmm4
469 movdqa -0x30(%rbp), %xmm5
471 movdqa -0x20(%rbp), %xmm6
473 movdqa -0x10(%rbp), %xmm7
476 cmp %r11, %r11 // set eq for nonstret forwarding
478 test %r11, %r11 // set ne for stret forwarding
486 /////////////////////////////////////////////////////////////////////
488 // GetIsaFast return-type
489 // GetIsaSupport return-type
491 // Sets r10 = obj->isa. Consults the tagged isa table if necessary.
493 // Takes: $0 = NORMAL or FPRET or FP2RET or STRET
494 // a1 or a2 (STRET) = receiver
496 // On exit: r10 = receiver->isa
499 /////////////////////////////////////////////////////////////////////
506 movq $$0x00007ffffffffff8, %r10
512 movq $$0x00007ffffffffff8, %r10
529 leaq _objc_debug_taggedpointer_classes(%rip), %r10
530 movq (%r10, %r11, 8), %r10 // read isa from table
541 leaq _objc_debug_taggedpointer_ext_classes(%rip), %r10
542 movq (%r10, %r11, 8), %r10 // read isa from table
547 /////////////////////////////////////////////////////////////////////
549 // NilTest return-type
551 // Takes: $0 = NORMAL or FPRET or FP2RET or STRET
552 // %a1 or %a2 (STRET) = receiver
554 // On exit: Loads non-nil receiver in %a1 or %a2 (STRET)
557 // NilTestReturnZero return-type
559 // Takes: $0 = NORMAL or FPRET or FP2RET or STRET
560 // %a1 or %a2 (STRET) = receiver
562 // On exit: Loads non-nil receiver in %a1 or %a2 (STRET)
565 // NilTestReturnIMP return-type
567 // Takes: $0 = NORMAL or FPRET or FP2RET or STRET
568 // %a1 or %a2 (STRET) = receiver
570 // On exit: Loads non-nil receiver in %a1 or %a2 (STRET)
571 // or returns an IMP in r11 that returns zero.
573 /////////////////////////////////////////////////////////////////////
582 .macro ZeroReturnFPRET
587 .macro ZeroReturnFP2RET
593 .macro ZeroReturnSTRET
594 // rax gets the struct-return address as passed in rdi
598 STATIC_ENTRY __objc_msgNil
601 END_ENTRY __objc_msgNil
603 STATIC_ENTRY __objc_msgNil_fpret
606 END_ENTRY __objc_msgNil_fpret
608 STATIC_ENTRY __objc_msgNil_fp2ret
611 END_ENTRY __objc_msgNil_fp2ret
613 STATIC_ENTRY __objc_msgNil_stret
616 END_ENTRY __objc_msgNil_stret
630 .macro NilTestReturnZero
650 .macro NilTestReturnIMP
655 leaq __objc_msgNil(%rip), %r11
657 leaq __objc_msgNil_fpret(%rip), %r11
659 leaq __objc_msgNil_fp2ret(%rip), %r11
661 leaq __objc_msgNil_stret(%rip), %r11
669 /********************************************************************
670 * IMP cache_getImp(Class cls, SEL sel)
672 * On entry: a1 = class whose cache is to be searched
673 * a2 = selector to search for
675 * If found, returns method implementation.
676 * If not found, returns NULL.
677 ********************************************************************/
679 STATIC_ENTRY _cache_getImp
682 movq %a1, %r10 // move class to r10 for CacheLookup
683 CacheLookup NORMAL, GETIMP // returns IMP on success
686 // cache miss, return nil
690 END_ENTRY _cache_getImp
693 /********************************************************************
695 * id objc_msgSend(id self, SEL _cmd,...);
696 * IMP objc_msgLookup(id self, SEL _cmd, ...);
698 * objc_msgLookup ABI:
699 * IMP returned in r11
700 * Forwarding returned in Z flag
701 * r10 reserved for our use but not used
703 ********************************************************************/
707 .globl _objc_debug_taggedpointer_classes
708 _objc_debug_taggedpointer_classes:
710 .globl _objc_debug_taggedpointer_ext_classes
711 _objc_debug_taggedpointer_ext_classes:
715 UNWIND _objc_msgSend, NoFrame
720 GetIsaFast NORMAL // r10 = self->isa
721 CacheLookup NORMAL, CALL // calls IMP on success
723 NilTestReturnZero NORMAL
727 // cache miss: go search the method lists
731 jmp __objc_msgSend_uncached
733 END_ENTRY _objc_msgSend
736 ENTRY _objc_msgLookup
740 GetIsaFast NORMAL // r10 = self->isa
741 CacheLookup NORMAL, LOOKUP // returns IMP on success
743 NilTestReturnIMP NORMAL
747 // cache miss: go search the method lists
750 jmp __objc_msgLookup_uncached
752 END_ENTRY _objc_msgLookup
755 ENTRY _objc_msgSend_fixup
757 END_ENTRY _objc_msgSend_fixup
760 STATIC_ENTRY _objc_msgSend_fixedup
761 // Load _cmd from the message_ref
764 END_ENTRY _objc_msgSend_fixedup
767 /********************************************************************
769 * id objc_msgSendSuper(struct objc_super *super, SEL _cmd,...);
771 * struct objc_super {
775 ********************************************************************/
777 ENTRY _objc_msgSendSuper
778 UNWIND _objc_msgSendSuper, NoFrame
781 // search the cache (objc_super in %a1)
782 movq class(%a1), %r10 // class = objc_super->class
783 movq receiver(%a1), %a1 // load real receiver
784 CacheLookup NORMAL, CALL // calls IMP on success
786 // cache miss: go search the method lists
788 // class still in r10
790 jmp __objc_msgSend_uncached
792 END_ENTRY _objc_msgSendSuper
795 /********************************************************************
796 * id objc_msgSendSuper2
797 ********************************************************************/
799 ENTRY _objc_msgSendSuper2
800 UNWIND _objc_msgSendSuper2, NoFrame
803 // objc_super->class is superclass of class to search
805 // search the cache (objc_super in %a1)
806 movq class(%a1), %r10 // cls = objc_super->class
807 movq receiver(%a1), %a1 // load real receiver
808 movq 8(%r10), %r10 // cls = class->superclass
809 CacheLookup NORMAL, CALL // calls IMP on success
811 // cache miss: go search the method lists
813 // superclass still in r10
815 jmp __objc_msgSend_uncached
817 END_ENTRY _objc_msgSendSuper2
820 ENTRY _objc_msgLookupSuper2
822 // objc_super->class is superclass of class to search
824 // search the cache (objc_super in %a1)
825 movq class(%a1), %r10 // cls = objc_super->class
826 movq receiver(%a1), %a1 // load real receiver
827 movq 8(%r10), %r10 // cls = class->superclass
828 CacheLookup NORMAL, LOOKUP // returns IMP on success
830 // cache miss: go search the method lists
832 // superclass still in r10
833 jmp __objc_msgLookup_uncached
835 END_ENTRY _objc_msgLookupSuper2
838 ENTRY _objc_msgSendSuper2_fixup
840 END_ENTRY _objc_msgSendSuper2_fixup
843 STATIC_ENTRY _objc_msgSendSuper2_fixedup
844 // Load _cmd from the message_ref
846 jmp _objc_msgSendSuper2
847 END_ENTRY _objc_msgSendSuper2_fixedup
850 /********************************************************************
852 * double objc_msgSend_fpret(id self, SEL _cmd,...);
853 * Used for `long double` return only. `float` and `double` use objc_msgSend.
855 ********************************************************************/
857 ENTRY _objc_msgSend_fpret
858 UNWIND _objc_msgSend_fpret, NoFrame
863 GetIsaFast FPRET // r10 = self->isa
864 CacheLookup FPRET, CALL // calls IMP on success
866 NilTestReturnZero FPRET
870 // cache miss: go search the method lists
874 jmp __objc_msgSend_uncached
876 END_ENTRY _objc_msgSend_fpret
879 ENTRY _objc_msgLookup_fpret
883 GetIsaFast FPRET // r10 = self->isa
884 CacheLookup FPRET, LOOKUP // returns IMP on success
886 NilTestReturnIMP FPRET
890 // cache miss: go search the method lists
893 jmp __objc_msgLookup_uncached
895 END_ENTRY _objc_msgLookup_fpret
898 ENTRY _objc_msgSend_fpret_fixup
900 END_ENTRY _objc_msgSend_fpret_fixup
903 STATIC_ENTRY _objc_msgSend_fpret_fixedup
904 // Load _cmd from the message_ref
906 jmp _objc_msgSend_fpret
907 END_ENTRY _objc_msgSend_fpret_fixedup
910 /********************************************************************
912 * double objc_msgSend_fp2ret(id self, SEL _cmd,...);
913 * Used for `complex long double` return only.
915 ********************************************************************/
917 ENTRY _objc_msgSend_fp2ret
918 UNWIND _objc_msgSend_fp2ret, NoFrame
923 GetIsaFast FP2RET // r10 = self->isa
924 CacheLookup FP2RET, CALL // calls IMP on success
926 NilTestReturnZero FP2RET
930 // cache miss: go search the method lists
934 jmp __objc_msgSend_uncached
936 END_ENTRY _objc_msgSend_fp2ret
939 ENTRY _objc_msgLookup_fp2ret
943 GetIsaFast FP2RET // r10 = self->isa
944 CacheLookup FP2RET, LOOKUP // returns IMP on success
946 NilTestReturnIMP FP2RET
950 // cache miss: go search the method lists
953 jmp __objc_msgLookup_uncached
955 END_ENTRY _objc_msgLookup_fp2ret
958 ENTRY _objc_msgSend_fp2ret_fixup
960 END_ENTRY _objc_msgSend_fp2ret_fixup
963 STATIC_ENTRY _objc_msgSend_fp2ret_fixedup
964 // Load _cmd from the message_ref
966 jmp _objc_msgSend_fp2ret
967 END_ENTRY _objc_msgSend_fp2ret_fixedup
970 /********************************************************************
972 * void objc_msgSend_stret(void *st_addr, id self, SEL _cmd, ...);
974 * objc_msgSend_stret is the struct-return form of msgSend.
975 * The ABI calls for %a1 to be used as the address of the structure
976 * being returned, with the parameters in the succeeding locations.
978 * On entry: %a1 is the address where the structure is returned,
979 * %a2 is the message receiver,
980 * %a3 is the selector
981 ********************************************************************/
983 ENTRY _objc_msgSend_stret
984 UNWIND _objc_msgSend_stret, NoFrame
989 GetIsaFast STRET // r10 = self->isa
990 CacheLookup STRET, CALL // calls IMP on success
992 NilTestReturnZero STRET
996 // cache miss: go search the method lists
1000 jmp __objc_msgSend_stret_uncached
1002 END_ENTRY _objc_msgSend_stret
1005 ENTRY _objc_msgLookup_stret
1009 GetIsaFast STRET // r10 = self->isa
1010 CacheLookup STRET, LOOKUP // returns IMP on success
1012 NilTestReturnIMP STRET
1016 // cache miss: go search the method lists
1019 jmp __objc_msgLookup_stret_uncached
1021 END_ENTRY _objc_msgLookup_stret
1024 ENTRY _objc_msgSend_stret_fixup
1026 END_ENTRY _objc_msgSend_stret_fixup
1029 STATIC_ENTRY _objc_msgSend_stret_fixedup
1030 // Load _cmd from the message_ref
1032 jmp _objc_msgSend_stret
1033 END_ENTRY _objc_msgSend_stret_fixedup
1036 /********************************************************************
1038 * void objc_msgSendSuper_stret(void *st_addr, struct objc_super *super, SEL _cmd, ...);
1040 * struct objc_super {
1045 * objc_msgSendSuper_stret is the struct-return form of msgSendSuper.
1046 * The ABI calls for (sp+4) to be used as the address of the structure
1047 * being returned, with the parameters in the succeeding registers.
1049 * On entry: %a1 is the address where the structure is returned,
1050 * %a2 is the address of the objc_super structure,
1051 * %a3 is the selector
1053 ********************************************************************/
1055 ENTRY _objc_msgSendSuper_stret
1056 UNWIND _objc_msgSendSuper_stret, NoFrame
1059 // search the cache (objc_super in %a2)
1060 movq class(%a2), %r10 // class = objc_super->class
1061 movq receiver(%a2), %a2 // load real receiver
1062 CacheLookup STRET, CALL // calls IMP on success
1064 // cache miss: go search the method lists
1066 // class still in r10
1068 jmp __objc_msgSend_stret_uncached
1070 END_ENTRY _objc_msgSendSuper_stret
1073 /********************************************************************
1074 * id objc_msgSendSuper2_stret
1075 ********************************************************************/
1077 ENTRY _objc_msgSendSuper2_stret
1078 UNWIND _objc_msgSendSuper2_stret, NoFrame
1081 // search the cache (objc_super in %a2)
1082 movq class(%a2), %r10 // class = objc_super->class
1083 movq receiver(%a2), %a2 // load real receiver
1084 movq 8(%r10), %r10 // class = class->superclass
1085 CacheLookup STRET, CALL // calls IMP on success
1087 // cache miss: go search the method lists
1089 // superclass still in r10
1091 jmp __objc_msgSend_stret_uncached
1093 END_ENTRY _objc_msgSendSuper2_stret
1096 ENTRY _objc_msgLookupSuper2_stret
1098 // search the cache (objc_super in %a2)
1099 movq class(%a2), %r10 // class = objc_super->class
1100 movq receiver(%a2), %a2 // load real receiver
1101 movq 8(%r10), %r10 // class = class->superclass
1102 CacheLookup STRET, LOOKUP // returns IMP on success
1104 // cache miss: go search the method lists
1106 // superclass still in r10
1107 jmp __objc_msgLookup_stret_uncached
1109 END_ENTRY _objc_msgLookupSuper2_stret
1112 ENTRY _objc_msgSendSuper2_stret_fixup
1114 END_ENTRY _objc_msgSendSuper2_stret_fixup
1117 STATIC_ENTRY _objc_msgSendSuper2_stret_fixedup
1118 // Load _cmd from the message_ref
1120 jmp _objc_msgSendSuper2_stret
1121 END_ENTRY _objc_msgSendSuper2_stret_fixedup
1124 /********************************************************************
1126 * _objc_msgSend_uncached
1127 * _objc_msgSend_stret_uncached
1128 * _objc_msgLookup_uncached
1129 * _objc_msgLookup_stret_uncached
1131 * The uncached method lookup.
1133 ********************************************************************/
1135 STATIC_ENTRY __objc_msgSend_uncached
1136 UNWIND __objc_msgSend_uncached, FrameWithNoSaves
1138 // THIS IS NOT A CALLABLE C FUNCTION
1139 // Out-of-band r10 is the searched class
1141 // r10 is already the class to search
1142 MethodTableLookup NORMAL // r11 = IMP
1143 jmp *%r11 // goto *imp
1145 END_ENTRY __objc_msgSend_uncached
1148 STATIC_ENTRY __objc_msgSend_stret_uncached
1149 UNWIND __objc_msgSend_stret_uncached, FrameWithNoSaves
1151 // THIS IS NOT A CALLABLE C FUNCTION
1152 // Out-of-band r10 is the searched class
1154 // r10 is already the class to search
1155 MethodTableLookup STRET // r11 = IMP
1156 jmp *%r11 // goto *imp
1158 END_ENTRY __objc_msgSend_stret_uncached
1161 STATIC_ENTRY __objc_msgLookup_uncached
1162 UNWIND __objc_msgLookup_uncached, FrameWithNoSaves
1164 // THIS IS NOT A CALLABLE C FUNCTION
1165 // Out-of-band r10 is the searched class
1167 // r10 is already the class to search
1168 MethodTableLookup NORMAL // r11 = IMP
1171 END_ENTRY __objc_msgLookup_uncached
1174 STATIC_ENTRY __objc_msgLookup_stret_uncached
1175 UNWIND __objc_msgLookup_stret_uncached, FrameWithNoSaves
1177 // THIS IS NOT A CALLABLE C FUNCTION
1178 // Out-of-band r10 is the searched class
1180 // r10 is already the class to search
1181 MethodTableLookup STRET // r11 = IMP
1184 END_ENTRY __objc_msgLookup_stret_uncached
1187 /********************************************************************
1189 * id _objc_msgForward(id self, SEL _cmd,...);
1191 * _objc_msgForward and _objc_msgForward_stret are the externally-callable
1192 * functions returned by things like method_getImplementation().
1193 * _objc_msgForward_impcache is the function pointer actually stored in
1196 ********************************************************************/
1198 STATIC_ENTRY __objc_msgForward_impcache
1199 // Method cache version
1201 // THIS IS NOT A CALLABLE C FUNCTION
1202 // Out-of-band condition register is NE for stret, EQ otherwise.
1208 jne __objc_msgForward_stret
1209 jmp __objc_msgForward
1211 END_ENTRY __objc_msgForward_impcache
1214 ENTRY __objc_msgForward
1215 // Non-stret version
1217 movq __objc_forward_handler(%rip), %r11
1220 END_ENTRY __objc_msgForward
1223 ENTRY __objc_msgForward_stret
1224 // Struct-return version
1226 movq __objc_forward_stret_handler(%rip), %r11
1229 END_ENTRY __objc_msgForward_stret
1232 ENTRY _objc_msgSend_debug
1234 END_ENTRY _objc_msgSend_debug
1236 ENTRY _objc_msgSendSuper2_debug
1237 jmp _objc_msgSendSuper2
1238 END_ENTRY _objc_msgSendSuper2_debug
1240 ENTRY _objc_msgSend_stret_debug
1241 jmp _objc_msgSend_stret
1242 END_ENTRY _objc_msgSend_stret_debug
1244 ENTRY _objc_msgSendSuper2_stret_debug
1245 jmp _objc_msgSendSuper2_stret
1246 END_ENTRY _objc_msgSendSuper2_stret_debug
1248 ENTRY _objc_msgSend_fpret_debug
1249 jmp _objc_msgSend_fpret
1250 END_ENTRY _objc_msgSend_fpret_debug
1252 ENTRY _objc_msgSend_fp2ret_debug
1253 jmp _objc_msgSend_fp2ret
1254 END_ENTRY _objc_msgSend_fp2ret_debug
1257 ENTRY _objc_msgSend_noarg
1259 END_ENTRY _objc_msgSend_noarg
1262 ENTRY _method_invoke
1264 movq method_imp(%a2), %r11
1265 movq method_name(%a2), %a2
1268 END_ENTRY _method_invoke
1271 ENTRY _method_invoke_stret
1273 movq method_imp(%a3), %r11
1274 movq method_name(%a3), %a3
1277 END_ENTRY _method_invoke_stret
1280 .section __DATA,__objc_msg_break