]> git.saurik.com Git - apple/objc4.git/blob - runtime/Accessors.subproj/objc-accessors-i386.s
objc4-371.2.tar.gz
[apple/objc4.git] / runtime / Accessors.subproj / objc-accessors-i386.s
1 /*
2 * Copyright (c) 2006 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
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 //
26 // ENTRY functionName
27 //
28 // Assembly directives to begin an exported function.
29 //
30 // Takes: functionName - name of the exported function
31 //////////////////////////////////////////////////////////////////////
32
33 .macro ENTRY
34 .text
35 .globl $0
36 $0:
37 .endmacro
38
39 //////////////////////////////////////////////////////////////////////
40 //
41 // END_ENTRY functionName
42 //
43 // Assembly directives to end an exported function. Just a placeholder,
44 // a close-parenthesis for ENTRY, until it is needed for something.
45 //
46 // Takes: functionName - name of the exported function
47 //////////////////////////////////////////////////////////////////////
48
49 .macro END_ENTRY
50 .endmacro
51
52 //////////////////////////////////////////////////////////////////////
53 //
54 // OBJC_GET_PROPERTY_OFFSET offset
55 //
56 // Optimized id typed accessor methods.
57 // Generates an accesssor for a specified compile time offset.
58 //
59 // Takes: offset - offset of an id typed instance variable
60 //////////////////////////////////////////////////////////////////////
61
62 .macro OBJC_GET_PROPERTY_OFFSET
63 .private_extern __objc_getProperty_offset_$0
64 ENTRY __objc_getProperty_offset_$0
65 movl 4(%esp), %eax
66 movl $0(%eax), %eax
67 ret
68 END_ENTRY __objc_getProperty_offset_$0
69 .endmacro
70
71 /*
72 * Thunk to retrieve PC.
73 * `call 1; 1: pop` sequence breaks any branch-prediction stack.
74 */
75 L_get_pc_thunk.edx:
76 movl (%esp,1), %edx
77 ret
78
79 .macro LAZY_PIC_FUNCTION_STUB
80 .data
81 .picsymbol_stub
82 L$0$stub:
83 .indirect_symbol $0
84 call L_get_pc_thunk.edx
85 L0$$0:
86 movl L$0$lz - L0$$0(%edx), %ecx
87 jmp *%ecx
88 L$0$stub_binder:
89 lea L$0$lz - L0$$0(%edx),%eax
90 pushl %eax
91 jmp dyld_stub_binding_helper
92 nop
93 .data
94 .lazy_symbol_pointer
95 L$0$lz:
96 .indirect_symbol $0
97 .long L$0$stub_binder
98 .endmacro
99
100 LAZY_PIC_FUNCTION_STUB _objc_assign_ivar_gc
101 #define OBJC_ASSIGN_IVAR L_objc_assign_ivar_gc$stub // call objc_assign_ivar_gc() directly to avoid extra levels of testing/branching
102
103 .macro OBJC_SET_PROPERTY_OFFSET
104 .private_extern __objc_setProperty_offset_$0
105 ENTRY __objc_setProperty_offset_$0
106 movl 4(%esp), %eax
107 movl %eax, 8(%esp) // pass self as the second parameter.
108 movl 12(%esp), %eax
109 movl %eax, 4(%esp) // pass value as the first parameter.
110 movl $$$0, 12(%esp) // pass the offset as the third parameter.
111 jmp OBJC_ASSIGN_IVAR // objc_assign_ivar_gc() is __private_extern__
112 END_ENTRY __objc_setProperty_offset_$0
113 .endmacro
114
115 /********************************************************************
116 * id _objc_getProperty_offset_N(id self, SEL _cmd);
117 ********************************************************************/
118
119 OBJC_GET_PROPERTY_OFFSET 0
120 OBJC_GET_PROPERTY_OFFSET 4
121 OBJC_GET_PROPERTY_OFFSET 8
122 OBJC_GET_PROPERTY_OFFSET 12
123 OBJC_GET_PROPERTY_OFFSET 16
124 OBJC_GET_PROPERTY_OFFSET 20
125 OBJC_GET_PROPERTY_OFFSET 24
126 OBJC_GET_PROPERTY_OFFSET 28
127 OBJC_GET_PROPERTY_OFFSET 32
128 OBJC_GET_PROPERTY_OFFSET 36
129 OBJC_GET_PROPERTY_OFFSET 40
130 OBJC_GET_PROPERTY_OFFSET 44
131 OBJC_GET_PROPERTY_OFFSET 48
132 OBJC_GET_PROPERTY_OFFSET 52
133 OBJC_GET_PROPERTY_OFFSET 56
134 OBJC_GET_PROPERTY_OFFSET 60
135 OBJC_GET_PROPERTY_OFFSET 64
136
137 /********************************************************************
138 * id _objc_setProperty_offset_N(id self, SEL _cmd, id value);
139 ********************************************************************/
140
141 OBJC_SET_PROPERTY_OFFSET 0
142 OBJC_SET_PROPERTY_OFFSET 4
143 OBJC_SET_PROPERTY_OFFSET 8
144 OBJC_SET_PROPERTY_OFFSET 12
145 OBJC_SET_PROPERTY_OFFSET 16
146 OBJC_SET_PROPERTY_OFFSET 20
147 OBJC_SET_PROPERTY_OFFSET 24
148 OBJC_SET_PROPERTY_OFFSET 28
149 OBJC_SET_PROPERTY_OFFSET 32
150 OBJC_SET_PROPERTY_OFFSET 36
151 OBJC_SET_PROPERTY_OFFSET 40
152 OBJC_SET_PROPERTY_OFFSET 44
153 OBJC_SET_PROPERTY_OFFSET 48
154 OBJC_SET_PROPERTY_OFFSET 52
155 OBJC_SET_PROPERTY_OFFSET 56
156 OBJC_SET_PROPERTY_OFFSET 60
157 OBJC_SET_PROPERTY_OFFSET 64