Merge pull request #2438 from lambdageek/cherry-pick-coop-handle
[mono.git] / mono / metadata / marshal.h
1
2 /*
3  * marshal.h: Routines for marshaling complex types in P/Invoke methods.
4  * 
5  * Author:
6  *   Paolo Molaro (lupus@ximian.com)
7  *
8  * (C) 2002 Ximian, Inc.  http://www.ximian.com
9  *
10  */
11
12 #ifndef __MONO_MARSHAL_H__
13 #define __MONO_MARSHAL_H__
14
15 #include <mono/metadata/class.h>
16 #include <mono/metadata/object-internals.h>
17 #include <mono/metadata/class-internals.h>
18 #include <mono/metadata/opcodes.h>
19 #include <mono/metadata/reflection.h>
20 #include <mono/metadata/method-builder.h>
21 #include <mono/metadata/remoting.h>
22
23 #define mono_marshal_find_bitfield_offset(type, elem, byte_offset, bitmask) \
24         do { \
25                 type tmp; \
26                 memset (&tmp, 0, sizeof (tmp)); \
27                 tmp.elem = 1; \
28                 mono_marshal_find_nonzero_bit_offset ((guint8*)&tmp, sizeof (tmp), (byte_offset), (bitmask)); \
29         } while (0)
30
31 /*
32  * This structure holds the state kept by the emit_ marshalling functions.
33  * This is exported so it can be used by cominterop.c.
34  */
35 typedef struct {
36         MonoMethodBuilder *mb;
37         MonoMethodSignature *sig;
38         MonoMethodPInvoke *piinfo;
39         int *orig_conv_args; /* Locals containing the original values of byref args */
40         int retobj_var;
41         MonoClass *retobj_class;
42         MonoMethodSignature *csig; /* Might need to be changed due to MarshalAs directives */
43         MonoImage *image; /* The image to use for looking up custom marshallers */
44 } EmitMarshalContext;
45
46 typedef enum {
47         /*
48          * This is invoked to convert arguments from the current types to
49          * the underlying types expected by the platform routine.  If required,
50          * the methods create a temporary variable with the proper type, and return
51          * the location for it (either the passed argument, or the newly allocated
52          * local slot).
53          */
54         MARSHAL_ACTION_CONV_IN,
55
56         /*
57          * This operation is called to push the actual value that was optionally
58          * converted on the first stage
59          */
60         MARSHAL_ACTION_PUSH,
61
62         /*
63          * Convert byref arguments back or free resources allocated during the
64          * CONV_IN stage
65          */
66         MARSHAL_ACTION_CONV_OUT,
67
68         /*
69          * The result from the unmanaged call is at the top of the stack when
70          * this action is invoked.    The result should be stored in the
71          * third local variable slot. 
72          */
73         MARSHAL_ACTION_CONV_RESULT,
74
75         MARSHAL_ACTION_MANAGED_CONV_IN,
76         MARSHAL_ACTION_MANAGED_CONV_OUT,
77         MARSHAL_ACTION_MANAGED_CONV_RESULT
78 } MarshalAction;
79
80 /*
81  * This is an extension of the MONO_WRAPPER_ enum to avoid adding more elements to that
82  * enum.
83  */
84 typedef enum {
85         WRAPPER_SUBTYPE_NONE,
86         /* Subtypes of MONO_WRAPPER_MANAGED_TO_MANAGED */
87         WRAPPER_SUBTYPE_ELEMENT_ADDR,
88         WRAPPER_SUBTYPE_STRING_CTOR,
89         /* Subtypes of MONO_WRAPPER_STELEMREF */
90         WRAPPER_SUBTYPE_VIRTUAL_STELEMREF,
91         /* Subtypes of MONO_WRAPPER_UNKNOWN */
92         WRAPPER_SUBTYPE_FAST_MONITOR_ENTER,
93         WRAPPER_SUBTYPE_FAST_MONITOR_ENTER_V4,
94         WRAPPER_SUBTYPE_FAST_MONITOR_EXIT,
95         WRAPPER_SUBTYPE_PTR_TO_STRUCTURE,
96         WRAPPER_SUBTYPE_STRUCTURE_TO_PTR,
97         /* Subtypes of MONO_WRAPPER_CASTCLASS */
98         WRAPPER_SUBTYPE_CASTCLASS_WITH_CACHE,
99         WRAPPER_SUBTYPE_ISINST_WITH_CACHE,
100         /* Subtypes of MONO_WRAPPER_RUNTIME_INVOKE */
101         WRAPPER_SUBTYPE_RUNTIME_INVOKE_NORMAL,
102         WRAPPER_SUBTYPE_RUNTIME_INVOKE_DYNAMIC,
103         WRAPPER_SUBTYPE_RUNTIME_INVOKE_DIRECT,
104         WRAPPER_SUBTYPE_RUNTIME_INVOKE_VIRTUAL,
105         /* Subtypes of MONO_WRAPPER_MANAGED_TO_NATIVE */
106         WRAPPER_SUBTYPE_ICALL_WRAPPER,
107         WRAPPER_SUBTYPE_NATIVE_FUNC_AOT,
108         WRAPPER_SUBTYPE_PINVOKE,
109         /* Subtypes of MONO_WRAPPER_UNKNOWN */
110         WRAPPER_SUBTYPE_SYNCHRONIZED_INNER,
111         WRAPPER_SUBTYPE_GSHAREDVT_IN,
112         WRAPPER_SUBTYPE_GSHAREDVT_OUT,
113         WRAPPER_SUBTYPE_ARRAY_ACCESSOR,
114         /* Subtypes of MONO_WRAPPER_MANAGED_TO_MANAGED */
115         WRAPPER_SUBTYPE_GENERIC_ARRAY_HELPER,
116         /* Subtypes of MONO_WRAPPER_DELEGATE_INVOKE */
117         WRAPPER_SUBTYPE_DELEGATE_INVOKE_VIRTUAL,
118         WRAPPER_SUBTYPE_DELEGATE_INVOKE_BOUND,
119         /* Subtypes of MONO_WRAPPER_UNKNOWN */
120         WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG,
121         WRAPPER_SUBTYPE_GSHAREDVT_OUT_SIG,
122 } WrapperSubtype;
123
124 typedef struct {
125         MonoMethod *method;
126         MonoClass *klass;
127 } NativeToManagedWrapperInfo;
128
129 typedef struct {
130         MonoMethod *method;
131 } StringCtorWrapperInfo;
132
133 typedef struct {
134         int kind;
135 } VirtualStelemrefWrapperInfo;
136
137 typedef struct {
138         guint32 rank, elem_size;
139 } ElementAddrWrapperInfo;
140
141 typedef struct {
142         MonoMethod *method;
143         /* For WRAPPER_SUBTYPE_RUNTIME_INVOKE_NORMAL */
144         MonoMethodSignature *sig;
145 } RuntimeInvokeWrapperInfo;
146
147 typedef struct {
148         MonoMethod *method;
149 } ManagedToNativeWrapperInfo;
150
151 typedef struct {
152         MonoMethod *method;
153 } SynchronizedWrapperInfo;
154
155 typedef struct {
156         MonoMethod *method;
157 } SynchronizedInnerWrapperInfo;
158
159 typedef struct {
160         MonoMethod *method;
161 } GenericArrayHelperWrapperInfo;
162
163 typedef struct {
164         gpointer func;
165 } ICallWrapperInfo;
166
167 typedef struct {
168         MonoMethod *method;
169 } ArrayAccessorWrapperInfo;
170
171 typedef struct {
172         MonoClass *klass;
173 } ProxyWrapperInfo;
174
175 typedef struct {
176         const char *gc_name;
177         int alloc_type;
178 } AllocatorWrapperInfo;
179
180 typedef struct {
181         MonoMethod *method;
182 } UnboxWrapperInfo;
183
184 typedef struct {
185         MonoMethod *method;
186 } RemotingWrapperInfo;
187
188 typedef struct {
189         MonoMethodSignature *sig;
190 } GsharedvtWrapperInfo;
191
192 /*
193  * This structure contains additional information to uniquely identify a given wrapper
194  * method. It can be retrieved by mono_marshal_get_wrapper_info () for certain types
195  * of wrappers, i.e. ones which do not have a 1-1 association with a method/class.
196  */
197 typedef struct {
198         WrapperSubtype subtype;
199         union {
200                 /* RUNTIME_INVOKE_... */
201                 RuntimeInvokeWrapperInfo runtime_invoke;
202                 /* STRING_CTOR */
203                 StringCtorWrapperInfo string_ctor;
204                 /* ELEMENT_ADDR */
205                 ElementAddrWrapperInfo element_addr;
206                 /* VIRTUAL_STELEMREF */
207                 VirtualStelemrefWrapperInfo virtual_stelemref;
208                 /* MONO_WRAPPER_NATIVE_TO_MANAGED */
209                 NativeToManagedWrapperInfo native_to_managed;
210                 /* MONO_WRAPPER_MANAGED_TO_NATIVE */
211                 ManagedToNativeWrapperInfo managed_to_native;
212                 /* SYNCHRONIZED */
213                 SynchronizedWrapperInfo synchronized;
214                 /* SYNCHRONIZED_INNER */
215                 SynchronizedInnerWrapperInfo synchronized_inner;
216                 /* GENERIC_ARRAY_HELPER */
217                 GenericArrayHelperWrapperInfo generic_array_helper;
218                 /* ICALL_WRAPPER */
219                 ICallWrapperInfo icall;
220                 /* ARRAY_ACCESSOR */
221                 ArrayAccessorWrapperInfo array_accessor;
222                 /* PROXY_ISINST etc. */
223                 ProxyWrapperInfo proxy;
224                 /* ALLOC */
225                 AllocatorWrapperInfo alloc;
226                 /* UNBOX */
227                 UnboxWrapperInfo unbox;
228                 /* MONO_WRAPPER_REMOTING_INVOKE/MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK/MONO_WRAPPER_XDOMAIN_INVOKE */
229                 RemotingWrapperInfo remoting;
230                 /* GSHAREDVT_IN_SIG/GSHAREDVT_OUT_SIG */
231                 GsharedvtWrapperInfo gsharedvt;
232         } d;
233 } WrapperInfo;
234
235 G_BEGIN_DECLS
236
237 /*type of the function pointer of methods returned by mono_marshal_get_runtime_invoke*/
238 typedef MonoObject *(*RuntimeInvokeFunction) (MonoObject *this_obj, void **params, MonoObject **exc, void* compiled_method);
239
240 typedef void (*RuntimeInvokeDynamicFunction) (void *args, MonoObject **exc, void* compiled_method);
241
242 /* marshaling helper functions */
243
244 void
245 mono_marshal_init (void);
246
247 void
248 mono_marshal_init_tls (void);
249
250 void
251 mono_marshal_cleanup (void);
252
253 gint32
254 mono_class_native_size (MonoClass *klass, guint32 *align);
255
256 MonoMarshalType *
257 mono_marshal_load_type_info (MonoClass* klass);
258
259 gint32
260 mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align,
261                         gboolean as_field, gboolean unicode);
262
263 int            
264 mono_type_native_stack_size (MonoType *type, guint32 *alignment);
265
266 gpointer
267 mono_array_to_savearray (MonoArray *array);
268
269 gpointer
270 mono_array_to_lparray (MonoArray *array);
271
272 void
273 mono_free_lparray (MonoArray *array, gpointer* nativeArray);
274
275 void
276 mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text);
277
278 void
279 mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text);
280
281 gchar*
282 mono_string_builder_to_utf8 (MonoStringBuilder *sb);
283
284 gunichar2*
285 mono_string_builder_to_utf16 (MonoStringBuilder *sb);
286
287 gpointer
288 mono_string_to_ansibstr (MonoString *string_obj);
289
290 gpointer
291 mono_string_to_bstr (MonoString *string_obj);
292
293 void
294 mono_string_to_byvalstr (gpointer dst, MonoString *src, int size);
295
296 void
297 mono_string_to_byvalwstr (gpointer dst, MonoString *src, int size);
298
299 gpointer
300 mono_delegate_to_ftnptr (MonoDelegate *delegate);
301
302 MonoDelegate*
303 mono_ftnptr_to_delegate (MonoClass *klass, gpointer ftn);
304
305 void mono_delegate_free_ftnptr (MonoDelegate *delegate);
306
307 void
308 mono_marshal_set_last_error (void);
309
310 gpointer
311 mono_marshal_asany (MonoObject *obj, MonoMarshalNative string_encoding, int param_attrs);
312
313 void
314 mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_encoding, int param_attrs);
315
316 guint
317 mono_type_to_ldind (MonoType *type);
318
319 guint
320 mono_type_to_stind (MonoType *type);
321
322 /* functions to create various architecture independent helper functions */
323
324 MonoMethod *
325 mono_marshal_method_from_wrapper (MonoMethod *wrapper);
326
327 WrapperInfo*
328 mono_wrapper_info_create (MonoMethodBuilder *mb, WrapperSubtype subtype);
329
330 void
331 mono_marshal_set_wrapper_info (MonoMethod *method, WrapperInfo *info);
332
333 WrapperInfo*
334 mono_marshal_get_wrapper_info (MonoMethod *wrapper);
335
336 MonoMethod *
337 mono_marshal_get_delegate_begin_invoke (MonoMethod *method);
338
339 MonoMethod *
340 mono_marshal_get_delegate_end_invoke (MonoMethod *method);
341
342 MonoMethod *
343 mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del);
344
345 MonoMethod *
346 mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt, gboolean static_method_with_first_arg_bound, MonoMethod *target_method);
347
348 MonoMethod *
349 mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean is_virtual);
350
351 MonoMethod*
352 mono_marshal_get_runtime_invoke_dynamic (void);
353
354 MonoMethod *
355 mono_marshal_get_runtime_invoke_for_sig (MonoMethodSignature *sig);
356
357 MonoMethodSignature*
358 mono_marshal_get_string_ctor_signature (MonoMethod *method);
359
360 MonoMethod *
361 mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc);
362
363 gpointer
364 mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type);
365
366 MonoMethod *
367 mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gconstpointer func, gboolean check_exceptions);
368
369 MonoMethod *
370 mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, gboolean aot);
371
372 MonoMethod *
373 mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func);
374
375 MonoMethod*
376 mono_marshal_get_native_func_wrapper_aot (MonoClass *klass);
377
378 MonoMethod *
379 mono_marshal_get_struct_to_ptr (MonoClass *klass);
380
381 MonoMethod *
382 mono_marshal_get_ptr_to_struct (MonoClass *klass);
383
384 MonoMethod *
385 mono_marshal_get_synchronized_wrapper (MonoMethod *method);
386
387 MonoMethod *
388 mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method);
389
390 MonoMethod *
391 mono_marshal_get_unbox_wrapper (MonoMethod *method);
392
393 MonoMethod *
394 mono_marshal_get_castclass_with_cache (void);
395
396 MonoMethod *
397 mono_marshal_get_isinst_with_cache (void);
398
399 MonoMethod *
400 mono_marshal_get_isinst (MonoClass *klass);
401
402 MonoMethod *
403 mono_marshal_get_castclass (MonoClass *klass);
404
405 MonoMethod *
406 mono_marshal_get_stelemref (void);
407
408 MonoMethod*
409 mono_marshal_get_virtual_stelemref (MonoClass *array_class);
410
411 MonoMethod**
412 mono_marshal_get_virtual_stelemref_wrappers (int *nwrappers);
413
414 MonoMethod*
415 mono_marshal_get_array_address (int rank, int elem_size);
416
417 MonoMethod *
418 mono_marshal_get_array_accessor_wrapper (MonoMethod *method);
419
420 MonoMethod *
421 mono_marshal_get_generic_array_helper (MonoClass *klass, MonoClass *iface,
422                                        gchar *name, MonoMethod *method);
423
424 MonoMethod *
425 mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method);
426
427 MonoMethod*
428 mono_marshal_get_gsharedvt_in_wrapper (void);
429
430 MonoMethod*
431 mono_marshal_get_gsharedvt_out_wrapper (void);
432
433 void
434 mono_marshal_free_dynamic_wrappers (MonoMethod *method);
435
436 void
437 mono_marshal_lock_internal (void);
438
439 void
440 mono_marshal_unlock_internal (void);
441
442 /* marshaling internal calls */
443
444 void * 
445 mono_marshal_alloc (gulong size);
446
447 void 
448 mono_marshal_free (gpointer ptr);
449
450 void
451 mono_marshal_free_array (gpointer *ptr, int size);
452
453 gboolean 
454 mono_marshal_free_ccw (MonoObject* obj);
455
456 void
457 cominterop_release_all_rcws (void); 
458
459 void
460 ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArray *src, gint32 start_index,
461                                                                     gpointer dest, gint32 length);
462
463 void
464 ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
465                                                                       MonoArray *dest, gint32 length);
466
467 MonoString *
468 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr);
469
470 MonoString *
471 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len);
472
473 MonoString *
474 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr);
475
476 MonoString *
477 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *ptr, gint32 len);
478
479 MonoString *
480 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr);
481
482 guint32
483 ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (MonoReflectionMethod *m);
484
485 guint32 
486 ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void);
487
488 guint32 
489 ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype);
490
491 void
492 ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old);
493
494 void
495 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, MonoObject *dst);
496
497 MonoObject *
498 ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type);
499
500 int
501 ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name);
502
503 gpointer
504 ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (MonoString *string);
505
506 gpointer
507 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string);
508
509 gpointer
510 ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string);
511
512 void
513 ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type);
514
515 void*
516 ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size);
517
518 void
519 ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr);
520
521 gpointer 
522 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size);
523
524 void*
525 ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (gpointer size);
526
527 gpointer 
528 ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, gpointer size);
529
530 void
531 ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr);
532
533 void
534 ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (void *ptr);
535
536 void*
537 ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArray *arrayobj, int index);
538
539 MonoDelegate*
540 ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionType *type);
541
542 int
543 ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (gpointer pUnk);
544
545 int
546 ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (gpointer pUnk, gpointer riid, gpointer* ppv);
547
548 int
549 ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (gpointer pUnk);
550
551 void*
552 ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (MonoObject* object);
553
554 MonoObject*
555 ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void* pUnk);
556
557 void*
558 ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObject* object);
559
560 void*
561 ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (MonoObject* object, MonoReflectionType* type);
562
563 MonoBoolean
564 ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (MonoObject* object);
565
566 gint32
567 ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (MonoObject* object);
568
569 MonoObject *
570 ves_icall_System_ComObject_CreateRCW (MonoReflectionType *type);
571
572 void
573 ves_icall_System_ComObject_ReleaseInterfaces(MonoComObject* obj);
574
575 gpointer
576 ves_icall_System_ComObject_GetInterfaceInternal (MonoComObject* obj, MonoReflectionType* type, MonoBoolean throw_exception);
577
578 void
579 ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropProxy* proxy);
580
581 MonoComInteropProxy*
582 ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk);
583
584 MONO_API void
585 mono_win32_compat_CopyMemory (gpointer dest, gconstpointer source, gsize length);
586
587 MONO_API void
588 mono_win32_compat_FillMemory (gpointer dest, gsize length, guchar fill);
589
590 MONO_API void
591 mono_win32_compat_MoveMemory (gpointer dest, gconstpointer source, gsize length);
592
593 MONO_API void
594 mono_win32_compat_ZeroMemory (gpointer dest, gsize length);
595
596 void
597 mono_marshal_find_nonzero_bit_offset (guint8 *buf, int len, int *byte_offset, guint8 *bitmask) MONO_LLVM_INTERNAL;
598
599 MonoMethodSignature*
600 mono_signature_no_pinvoke (MonoMethod *method);
601
602 /* Called from cominterop.c/remoting.c */
603
604 void
605 mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func, gboolean aot, gboolean check_exceptions, gboolean func_param);
606
607 void
608 mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle);
609
610 GHashTable*
611 mono_marshal_get_cache (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func);
612
613 MonoMethod*
614 mono_marshal_find_in_cache (GHashTable *cache, gpointer key);
615
616 MonoMethod*
617 mono_mb_create_and_cache (GHashTable *cache, gpointer key,
618                                                   MonoMethodBuilder *mb, MonoMethodSignature *sig,
619                                                   int max_stack);
620 void
621 mono_marshal_emit_thread_interrupt_checkpoint (MonoMethodBuilder *mb);
622
623 void
624 mono_marshal_emit_thread_force_interrupt_checkpoint (MonoMethodBuilder *mb);
625
626 void
627 mono_marshal_use_aot_wrappers (gboolean use);
628
629 MonoObject *
630 mono_marshal_xdomain_copy_value (MonoObject *val);
631
632 int
633 mono_mb_emit_save_args (MonoMethodBuilder *mb, MonoMethodSignature *sig, gboolean save_this);
634
635 void
636 mono_mb_emit_restore_result (MonoMethodBuilder *mb, MonoType *return_type);
637
638 MonoMethod*
639 mono_mb_create (MonoMethodBuilder *mb, MonoMethodSignature *sig,
640                                 int max_stack, WrapperInfo *info);
641
642 MonoMethod*
643 mono_mb_create_and_cache_full (GHashTable *cache, gpointer key,
644                                                            MonoMethodBuilder *mb, MonoMethodSignature *sig,
645                                                            int max_stack, WrapperInfo *info, gboolean *out_found);
646
647 G_END_DECLS
648
649 #endif /* __MONO_MARSHAL_H__ */
650
651