[runtime] Declare MonoProfilerCallContext::return_value offset.
[mono-project.git] / mono / metadata / object-offsets.h
blobdcf37e0015cf646f710a3c277e705980b25b6793
2 /**
3 \file
4 This is a parameterized header. It's supposed/ok to be included multiple times.
6 Input defines: (those to be defined by the includer file)
8 Required:
9 DECL_OFFSET(struct,field)
10 DECL_OFFSET2(struct,field,offset)
11 DECL_ALIGN(name,type)
12 DECL_ALIGN2(name,alignment)
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/.
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.
24 Output defines:
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
29 Environment defines (from config.h and CFLAGS):
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.
37 #undef HAS_CROSS_COMPILER_OFFSETS
38 #undef USED_CROSS_COMPILER_OFFSETS
40 #if !defined (MONO_GENERATING_OFFSETS) && defined (MONO_OFFSETS_FILE)
41 #include MONO_OFFSETS_FILE
42 #endif
44 #ifndef USED_CROSS_COMPILER_OFFSETS
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)
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)
62 // Offsets for structures defined in metadata/
63 #ifndef DISABLE_METADATA_OFFSETS
64 DECL_OFFSET(MonoObject, vtable)
65 DECL_OFFSET(MonoObject, synchronisation)
67 DECL_OFFSET(MonoObjectHandlePayload, __raw)
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)
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)
91 DECL_OFFSET(MonoDomain, stack_overflow_ex)
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)
101 DECL_OFFSET(MonoInternalThread, tid)
102 DECL_OFFSET(MonoInternalThread, small_id)
103 DECL_OFFSET(MonoInternalThread, static_data)
104 DECL_OFFSET(MonoInternalThread, last)
106 DECL_OFFSET(MonoMulticastDelegate, delegates)
108 DECL_OFFSET(MonoTransparentProxy, rp)
109 DECL_OFFSET(MonoTransparentProxy, remote_class)
110 DECL_OFFSET(MonoTransparentProxy, custom_type_info)
112 DECL_OFFSET(MonoRealProxy, target_domain_id)
113 DECL_OFFSET(MonoRealProxy, context)
114 DECL_OFFSET(MonoRealProxy, unwrapped_server)
116 DECL_OFFSET(MonoRemoteClass, proxy_class)
118 DECL_OFFSET(MonoArray, vector)
119 DECL_OFFSET(MonoArray, max_length)
120 DECL_OFFSET(MonoArray, bounds)
122 DECL_OFFSET(MonoArrayBounds, lower_bound)
123 DECL_OFFSET(MonoArrayBounds, length)
125 DECL_OFFSET(MonoSafeHandle, handle)
127 DECL_OFFSET(MonoHandleRef, handle)
129 DECL_OFFSET(MonoComInteropProxy, com_object)
131 DECL_OFFSET(MonoString, length)
132 DECL_OFFSET(MonoString, chars)
134 DECL_OFFSET(MonoException, message)
136 DECL_OFFSET(MonoTypedRef, type)
137 DECL_OFFSET(MonoTypedRef, klass)
138 DECL_OFFSET(MonoTypedRef, value)
140 //Internal structs
141 DECL_OFFSET(MonoThreadsSync, status)
142 DECL_OFFSET(MonoThreadsSync, nest)
144 DECL_OFFSET(MonoProfilerCallContext, method)
145 DECL_OFFSET(MonoProfilerCallContext, return_value)
147 #ifdef HAVE_SGEN_GC
148 DECL_OFFSET(SgenClientThreadInfo, in_critical_region)
149 DECL_OFFSET(SgenThreadInfo, tlab_next)
150 DECL_OFFSET(SgenThreadInfo, tlab_temp_end)
151 #endif
153 #endif //DISABLE METADATA OFFSETS
155 // Offsets for structures defined in mini/
156 #ifndef DISABLE_JIT_OFFSETS
157 DECL_OFFSET(MonoLMF, previous_lmf)
159 DECL_OFFSET(MonoMethodRuntimeGenericContext, class_vtable)
161 DECL_OFFSET(MonoJitTlsData, lmf)
162 DECL_OFFSET(MonoJitTlsData, class_cast_from)
163 DECL_OFFSET(MonoJitTlsData, class_cast_to)
164 DECL_OFFSET(MonoJitTlsData, restore_stack_prot)
166 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size)
167 DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, entries) //XXX more to fix here
169 DECL_OFFSET(MonoContinuation, stack_used_size)
170 DECL_OFFSET(MonoContinuation, saved_stack)
171 DECL_OFFSET(MonoContinuation, return_sp)
172 DECL_OFFSET(MonoContinuation, lmf)
173 DECL_OFFSET(MonoContinuation, return_ip)
175 DECL_OFFSET(MonoDelegateTrampInfo, invoke_impl)
176 DECL_OFFSET(MonoDelegateTrampInfo, method_ptr)
178 // Architecture-specific offsets
179 // -----------------------------
181 #if defined(TARGET_X86)
182 DECL_OFFSET(MonoContext, eax)
183 DECL_OFFSET(MonoContext, ebx)
184 DECL_OFFSET(MonoContext, ecx)
185 DECL_OFFSET(MonoContext, edx)
186 DECL_OFFSET(MonoContext, edi)
187 DECL_OFFSET(MonoContext, esi)
188 DECL_OFFSET(MonoContext, esp)
189 DECL_OFFSET(MonoContext, ebp)
190 DECL_OFFSET(MonoContext, eip)
192 DECL_OFFSET(MonoLMF, method)
193 DECL_OFFSET(MonoLMF, lmf_addr)
194 DECL_OFFSET(MonoLMF, esp)
195 DECL_OFFSET(MonoLMF, ebx)
196 DECL_OFFSET(MonoLMF, edi)
197 DECL_OFFSET(MonoLMF, esi)
198 DECL_OFFSET(MonoLMF, ebp)
199 DECL_OFFSET(MonoLMF, eip)
200 #elif defined(TARGET_AMD64)
201 DECL_OFFSET(MonoContext, gregs)
202 DECL_OFFSET(MonoContext, fregs)
204 DECL_OFFSET(MonoLMF, rsp)
205 DECL_OFFSET(MonoLMF, rbp)
206 DECL_OFFSET(MonoLMF, rip)
208 DECL_OFFSET(DynCallArgs, res)
210 DECL_OFFSET(MonoLMFTramp, ctx)
211 DECL_OFFSET(MonoLMFTramp, lmf_addr)
212 #elif defined(TARGET_ARM)
213 DECL_OFFSET(MonoLMF, sp)
214 DECL_OFFSET(MonoLMF, fp)
215 DECL_OFFSET(MonoLMF, ip)
216 DECL_OFFSET(MonoLMF, iregs)
217 DECL_OFFSET(MonoLMF, fregs)
218 DECL_OFFSET(DynCallArgs, fpregs)
219 DECL_OFFSET(DynCallArgs, has_fpregs)
220 DECL_OFFSET(SeqPointInfo, ss_tramp_addr)
221 #elif defined(TARGET_ARM64)
222 DECL_OFFSET(MonoLMF, pc)
223 DECL_OFFSET(MonoLMF, gregs)
224 DECL_OFFSET(DynCallArgs, regs)
225 DECL_OFFSET(DynCallArgs, fpregs)
226 DECL_OFFSET(DynCallArgs, n_fpargs)
227 DECL_OFFSET(DynCallArgs, n_fpret)
228 #endif
230 // Shared architecture offfsets
231 // ----------------------------
233 #if defined(TARGET_ARM) || defined(TARGET_ARM64)
234 DECL_OFFSET (MonoContext, pc)
235 DECL_OFFSET (MonoContext, regs)
236 DECL_OFFSET (MonoContext, fregs)
238 DECL_OFFSET(MonoLMF, lmf_addr)
240 DECL_OFFSET(SeqPointInfo, ss_trigger_page)
242 DECL_OFFSET(DynCallArgs, res)
243 DECL_OFFSET(DynCallArgs, res2)
244 #endif
246 #if defined(TARGET_ARM)
247 DECL_OFFSET(MonoLMF, method)
248 DECL_OFFSET(GSharedVtCallInfo, stack_usage)
249 DECL_OFFSET(GSharedVtCallInfo, vret_arg_reg)
250 DECL_OFFSET(GSharedVtCallInfo, ret_marshal)
251 DECL_OFFSET(GSharedVtCallInfo, vret_slot)
252 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
253 #endif
255 #if defined(TARGET_ARM64)
256 DECL_OFFSET (MonoContext, has_fregs)
258 DECL_OFFSET(GSharedVtCallInfo, stack_usage)
259 DECL_OFFSET(GSharedVtCallInfo, gsharedvt_in)
260 DECL_OFFSET(GSharedVtCallInfo, ret_marshal)
261 DECL_OFFSET(GSharedVtCallInfo, vret_slot)
262 #endif
264 #if defined(TARGET_AMD64) || defined(TARGET_ARM64)
265 DECL_OFFSET(SeqPointInfo, ss_tramp_addr)
266 #endif
268 #if defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_ARM64)
269 DECL_OFFSET(SeqPointInfo, bp_addrs)
270 #endif
272 #ifdef ENABLE_INTERPRETER
273 DECL_OFFSET(InterpMethodArguments, ilen)
274 DECL_OFFSET(InterpMethodArguments, iargs)
275 DECL_OFFSET(InterpMethodArguments, flen)
276 DECL_OFFSET(InterpMethodArguments, fargs)
277 DECL_OFFSET(InterpMethodArguments, retval)
278 DECL_OFFSET(InterpMethodArguments, is_float_ret)
279 #endif
281 #endif //DISABLE_JIT_OFFSETS
283 #endif //USED_CROSS_COMPILER_OFFSETS
285 #undef DECL_OFFSET
286 #undef DECL_OFFSET2
287 #undef DECL_ALIGN
288 #undef DECL_ALIGN2
289 #undef DECL_SIZE
290 #undef DECL_SIZE2
291 #undef USE_CROSS_COMPILE_OFFSETS