Merge pull request #4967 from kumpera/profiler-arg-cleanup
[mono.git] / mono / metadata / object-offsets.h
1
2 /**
3 \file
4 This is a parameterized header. It's supposed/ok to be included multiple times.
5
6 Input defines: (those to be defined by the includer file)
7
8 Required:
9 DECL_OFFSET(struct,field)
10 DECL_OFFSET2(struct,field,offset)
11 DECL_ALIGN(name,type)
12 DECL_ALIGN2(name,alignment)
13
14 Optional:
15 USE_CROSS_COMPILE_OFFSETS - if defined, force the cross compiler offsets to be used, otherwise
16         they will only be used if MONO_CROSS_COMPILE is defined
17 DISABLE_METADATA_OFFSETS - Disable the definition of offsets for structures defined in metadata/.
18 DISABLE_JIT_OFFSETS - Disable the definition of offsets for structures defined in mini/.
19
20 The last two are needed because metadata shouldn't include JIT offsets since the structures
21 are not defined, while the JIT shouldn't include metadata offsets, since some of them
22 are GC specific, and the JIT needs to remain GC agnostic.
23
24 Output defines:
25
26 HAS_CROSS_COMPILER_OFFSETS - if set, it means we found some cross offsets, it doesnt mean we'll use it.
27 USED_CROSS_COMPILER_OFFSETS - if set, it means we used the cross offsets
28
29 Environment defines (from config.h and CFLAGS):
30
31 MONO_GENERATING_OFFSETS - Set by an offsets generating tool to disable the usage of any (possibly non-existing) generated header.
32 MONO_OFFSETS_FILE - Name of the header file containing the offsets to be used.
33
34 */
35
36
37 #undef HAS_CROSS_COMPILER_OFFSETS
38 #undef USED_CROSS_COMPILER_OFFSETS
39
40 #if !defined (MONO_GENERATING_OFFSETS) && defined (MONO_OFFSETS_FILE)
41 #include MONO_OFFSETS_FILE
42 #endif
43
44 #ifndef USED_CROSS_COMPILER_OFFSETS
45
46 DECL_ALIGN(gint8)
47 DECL_ALIGN(gint16)
48 DECL_ALIGN(gint32)
49 DECL_ALIGN(gint64)
50 DECL_ALIGN(float)
51 DECL_ALIGN(double)
52 DECL_ALIGN(gpointer)
53
54 DECL_SIZE(gint8)
55 DECL_SIZE(gint16)
56 DECL_SIZE(gint32)
57 DECL_SIZE(gint64)
58 DECL_SIZE(float)
59 DECL_SIZE(double)
60 DECL_SIZE(gpointer)
61
62 // Offsets for structures defined in metadata/
63 #ifndef DISABLE_METADATA_OFFSETS
64 DECL_OFFSET(MonoObject, vtable)
65 DECL_OFFSET(MonoObject, synchronisation)
66
67 DECL_OFFSET(MonoObjectHandlePayload, __raw)
68
69 DECL_OFFSET(MonoClass, interface_bitmap)
70 DECL_OFFSET(MonoClass, byval_arg)
71 DECL_OFFSET(MonoClass, cast_class)
72 DECL_OFFSET(MonoClass, element_class)
73 DECL_OFFSET(MonoClass, idepth)
74 DECL_OFFSET(MonoClass, instance_size)
75 DECL_OFFSET(MonoClass, interface_id)
76 DECL_OFFSET(MonoClass, max_interface_id)
77 DECL_OFFSET(MonoClass, parent)
78 DECL_OFFSET(MonoClass, rank)
79 DECL_OFFSET(MonoClass, sizes)
80 DECL_OFFSET(MonoClass, supertypes)
81
82 DECL_OFFSET(MonoVTable, klass)
83 DECL_OFFSET(MonoVTable, max_interface_id)
84 DECL_OFFSET(MonoVTable, interface_bitmap)
85 DECL_OFFSET(MonoVTable, vtable)
86 DECL_OFFSET(MonoVTable, rank)
87 DECL_OFFSET(MonoVTable, initialized)
88 DECL_OFFSET(MonoVTable, type)
89 DECL_OFFSET(MonoVTable, runtime_generic_context)
90
91 DECL_OFFSET(MonoDomain, stack_overflow_ex)
92
93 DECL_OFFSET(MonoDelegate, target)
94 DECL_OFFSET(MonoDelegate, method_ptr)
95 DECL_OFFSET(MonoDelegate, invoke_impl)
96 DECL_OFFSET(MonoDelegate, method)
97 DECL_OFFSET(MonoDelegate, method_code)
98 DECL_OFFSET(MonoDelegate, method_is_virtual)
99 DECL_OFFSET(MonoDelegate, extra_arg)
100
101 DECL_OFFSET(MonoInternalThread, tid)
102 DECL_OFFSET(MonoInternalThread, small_id)
103 DECL_OFFSET(MonoInternalThread, static_data)
104 DECL_OFFSET(MonoInternalThread, last)
105
106 DECL_OFFSET(MonoMulticastDelegate, delegates)
107
108 DECL_OFFSET(MonoTransparentProxy, rp)
109 DECL_OFFSET(MonoTransparentProxy, remote_class)
110 DECL_OFFSET(MonoTransparentProxy, custom_type_info)
111
112 DECL_OFFSET(MonoRealProxy, target_domain_id)
113 DECL_OFFSET(MonoRealProxy, context)
114 DECL_OFFSET(MonoRealProxy, unwrapped_server)
115
116 DECL_OFFSET(MonoRemoteClass, proxy_class)
117
118 DECL_OFFSET(MonoArray, vector)
119 DECL_OFFSET(MonoArray, max_length)
120 DECL_OFFSET(MonoArray, bounds)
121
122 DECL_OFFSET(MonoArrayBounds, lower_bound)
123 DECL_OFFSET(MonoArrayBounds, length)
124
125 DECL_OFFSET(MonoSafeHandle, handle)
126
127 DECL_OFFSET(MonoHandleRef, handle)
128
129 DECL_OFFSET(MonoComInteropProxy, com_object)
130
131 DECL_OFFSET(MonoString, length)
132 DECL_OFFSET(MonoString, chars)
133
134 DECL_OFFSET(MonoException, message)
135
136 DECL_OFFSET(MonoTypedRef, type)
137 DECL_OFFSET(MonoTypedRef, klass)
138 DECL_OFFSET(MonoTypedRef, value)
139
140 //Internal structs
141 DECL_OFFSET(MonoThreadsSync, status)
142 DECL_OFFSET(MonoThreadsSync, nest)
143
144 #ifdef HAVE_SGEN_GC
145 DECL_OFFSET(SgenClientThreadInfo, in_critical_region)
146 DECL_OFFSET(SgenThreadInfo, tlab_next)
147 DECL_OFFSET(SgenThreadInfo, tlab_temp_end)
148 #endif
149
150 #endif //DISABLE METADATA OFFSETS
151
152 // Offsets for structures defined in mini/
153 #ifndef DISABLE_JIT_OFFSETS
154 DECL_OFFSET(MonoLMF, previous_lmf)
155
156 DECL_OFFSET(MonoMethodRuntimeGenericContext, class_vtable)
157
158 DECL_OFFSET(MonoJitTlsData, lmf)
159 DECL_OFFSET(MonoJitTlsData, class_cast_from)
160 DECL_OFFSET(MonoJitTlsData, class_cast_to)
161 DECL_OFFSET(MonoJitTlsData, handler_block_return_address)
162 DECL_OFFSET(MonoJitTlsData, restore_stack_prot)
163
164 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size)
165 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, entries) //XXX more to fix here
166
167 DECL_OFFSET(MonoContinuation, stack_used_size)
168 DECL_OFFSET(MonoContinuation, saved_stack)
169 DECL_OFFSET(MonoContinuation, return_sp)
170 DECL_OFFSET(MonoContinuation, lmf)
171 DECL_OFFSET(MonoContinuation, return_ip)
172
173 DECL_OFFSET(MonoDelegateTrampInfo, invoke_impl)
174 DECL_OFFSET(MonoDelegateTrampInfo, method_ptr)
175
176 // Architecture-specific offsets
177 // -----------------------------
178
179 #if defined(TARGET_X86)
180 DECL_OFFSET(MonoContext, eax)
181 DECL_OFFSET(MonoContext, ebx)
182 DECL_OFFSET(MonoContext, ecx)
183 DECL_OFFSET(MonoContext, edx)
184 DECL_OFFSET(MonoContext, edi)
185 DECL_OFFSET(MonoContext, esi)
186 DECL_OFFSET(MonoContext, esp)
187 DECL_OFFSET(MonoContext, ebp)
188 DECL_OFFSET(MonoContext, eip)
189
190 DECL_OFFSET(MonoLMF, method)
191 DECL_OFFSET(MonoLMF, lmf_addr)
192 DECL_OFFSET(MonoLMF, esp)
193 DECL_OFFSET(MonoLMF, ebx)
194 DECL_OFFSET(MonoLMF, edi)
195 DECL_OFFSET(MonoLMF, esi)
196 DECL_OFFSET(MonoLMF, ebp)
197 DECL_OFFSET(MonoLMF, eip)
198 #elif defined(TARGET_AMD64)
199 DECL_OFFSET(MonoContext, gregs)
200 DECL_OFFSET(MonoContext, fregs)
201
202 DECL_OFFSET(MonoLMF, rsp)
203 DECL_OFFSET(MonoLMF, rbp)
204 DECL_OFFSET(MonoLMF, rip)
205
206 DECL_OFFSET(DynCallArgs, res)
207
208 DECL_OFFSET(MonoLMFTramp, ctx)
209 DECL_OFFSET(MonoLMFTramp, lmf_addr)
210 #elif defined(TARGET_ARM)
211 DECL_OFFSET(MonoLMF, sp)
212 DECL_OFFSET(MonoLMF, fp)
213 DECL_OFFSET(MonoLMF, ip)
214 DECL_OFFSET(MonoLMF, iregs)
215 DECL_OFFSET(MonoLMF, fregs)
216 DECL_OFFSET(DynCallArgs, fpregs)
217 DECL_OFFSET(DynCallArgs, has_fpregs)
218 DECL_OFFSET(SeqPointInfo, ss_tramp_addr)
219 #elif defined(TARGET_ARM64)
220 DECL_OFFSET(MonoLMF, pc)
221 DECL_OFFSET(MonoLMF, gregs)
222 DECL_OFFSET(DynCallArgs, regs)
223 DECL_OFFSET(DynCallArgs, fpregs)
224 DECL_OFFSET(DynCallArgs, n_fpargs)
225 DECL_OFFSET(DynCallArgs, n_fpret)
226 #endif
227
228 // Shared architecture offfsets
229 // ----------------------------
230
231 #if defined(TARGET_ARM) || defined(TARGET_ARM64)
232 DECL_OFFSET (MonoContext, pc)
233 DECL_OFFSET (MonoContext, regs)
234 DECL_OFFSET (MonoContext, fregs)
235
236 DECL_OFFSET(MonoLMF, lmf_addr)
237
238 DECL_OFFSET(SeqPointInfo, ss_trigger_page)
239
240 DECL_OFFSET(DynCallArgs, res)
241 DECL_OFFSET(DynCallArgs, res2)
242 #endif
243
244 #if defined(TARGET_ARM)
245 DECL_OFFSET(MonoLMF, method)
246 DECL_OFFSET(GSharedVtCallInfo, stack_usage)
247 DECL_OFFSET(GSharedVtCallInfo, vret_arg_reg)
248 DECL_OFFSET(GSharedVtCallInfo, ret_marshal)
249 DECL_OFFSET(GSharedVtCallInfo, vret_slot)
250 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
251 #endif
252
253 #if defined(TARGET_ARM64)
254 DECL_OFFSET (MonoContext, has_fregs)
255
256 DECL_OFFSET(GSharedVtCallInfo, stack_usage)
257 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
258 DECL_OFFSET(GSharedVtCallInfo, ret_marshal)
259 DECL_OFFSET(GSharedVtCallInfo, vret_slot)
260 #endif
261
262 #if defined(TARGET_AMD64) || defined(TARGET_ARM64)
263 DECL_OFFSET(SeqPointInfo, ss_tramp_addr)
264 #endif
265
266 #if defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_ARM64)
267 DECL_OFFSET(SeqPointInfo, bp_addrs)
268 #endif
269
270 #ifdef ENABLE_INTERPRETER
271 DECL_OFFSET(InterpMethodArguments, ilen)
272 DECL_OFFSET(InterpMethodArguments, iargs)
273 DECL_OFFSET(InterpMethodArguments, flen)
274 DECL_OFFSET(InterpMethodArguments, fargs)
275 DECL_OFFSET(InterpMethodArguments, retval)
276 DECL_OFFSET(InterpMethodArguments, is_float_ret)
277 #endif
278
279 #endif //DISABLE_JIT_OFFSETS
280
281 #endif //USED_CROSS_COMPILER_OFFSETS
282
283 #undef DECL_OFFSET
284 #undef DECL_OFFSET2
285 #undef DECL_ALIGN
286 #undef DECL_ALIGN2
287 #undef DECL_SIZE
288 #undef DECL_SIZE2
289 #undef USE_CROSS_COMPILE_OFFSETS