2010-03-12 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / metadata / object-internals.h
blob37be81878e4227ea141a208e9a48782bfba7611e
1 #ifndef __MONO_OBJECT_INTERNALS_H__
2 #define __MONO_OBJECT_INTERNALS_H__
4 #include <mono/metadata/object.h>
5 #include <mono/metadata/threads.h>
6 #include <mono/metadata/reflection.h>
7 #include <mono/metadata/mempool.h>
8 #include <mono/metadata/class-internals.h>
9 #include <mono/metadata/threads-types.h>
10 #include <mono/io-layer/io-layer.h>
11 #include "mono/utils/mono-compiler.h"
12 #include "mono/utils/mono-error.h"
14 /*
15 * We should find a better place for this stuff. We can't put it in mono-compiler.h,
16 * since that is included by libgc.
18 #ifndef G_LIKELY
19 #define G_LIKELY(a) (a)
20 #define G_UNLIKELY(a) (a)
21 #endif
24 * glib defines this macro and uses it in the definition of G_LIKELY, and thus,
25 * g_assert (). The macro expands to a complex piece of code, preventing some
26 * gcc versions like 4.3.0 from handling the __builtin_expect construct properly,
27 * causing the generation of the unlikely branch into the middle of the code.
29 #ifdef _G_BOOLEAN_EXPR
30 #undef _G_BOOLEAN_EXPR
31 #define _G_BOOLEAN_EXPR(expr) ((gsize)(expr) != 0)
32 #endif
34 #if 1
35 #ifdef __GNUC__
36 #define mono_assert(expr) G_STMT_START{ \
37 if (!(expr)) \
38 { \
39 MonoException *ex; \
40 char *msg = g_strdup_printf ("file %s: line %d (%s): " \
41 "assertion failed: (%s)", __FILE__, __LINE__, \
42 __PRETTY_FUNCTION__, #expr); \
43 ex = mono_get_exception_execution_engine (msg); \
44 g_free (msg); \
45 mono_raise_exception (ex); \
46 }; }G_STMT_END
48 #define mono_assert_not_reached() G_STMT_START{ \
49 MonoException *ex; \
50 char *msg = g_strdup_printf ("file %s: line %d (%s): " \
51 "should not be reached", __FILE__, __LINE__, __PRETTY_FUNCTION__); \
52 ex = mono_get_exception_execution_engine (msg); \
53 g_free (msg); \
54 mono_raise_exception (ex); \
55 }G_STMT_END
56 #else /* not GNUC */
57 #define mono_assert(expr) G_STMT_START{ \
58 if (!(expr)) \
59 { \
60 MonoException *ex; \
61 char *msg = g_strdup_printf ("file %s: line %d: " \
62 "assertion failed: (%s)", __FILE__, __LINE__, \
63 #expr); \
64 ex = mono_get_exception_execution_engine (msg); \
65 g_free (msg); \
66 mono_raise_exception (ex); \
67 }; }G_STMT_END
69 #define mono_assert_not_reached() G_STMT_START{ \
70 MonoException *ex; \
71 char *msg = g_strdup_printf ("file %s: line %d): " \
72 "should not be reached", __FILE__, __LINE__); \
73 ex = mono_get_exception_execution_engine (msg); \
74 g_free (msg); \
75 mono_raise_exception (ex); \
76 }G_STMT_END
77 #endif
78 #else
79 #define mono_assert(expr) g_assert(expr)
80 #define mono_assert_not_reached() g_assert_not_reached()
81 #endif
83 #define MONO_CHECK_ARG(arg, expr) G_STMT_START{ \
84 if (!(expr)) \
85 { \
86 MonoException *ex; \
87 char *msg = g_strdup_printf ("assertion `%s' failed", \
88 #expr); \
89 if (arg) {} /* check if the name exists */ \
90 ex = mono_get_exception_argument (#arg, msg); \
91 g_free (msg); \
92 mono_raise_exception (ex); \
93 }; }G_STMT_END
95 #define MONO_CHECK_ARG_NULL(arg) G_STMT_START{ \
96 if (arg == NULL) \
97 { \
98 MonoException *ex; \
99 if (arg) {} /* check if the name exists */ \
100 ex = mono_get_exception_argument_null (#arg); \
101 mono_raise_exception (ex); \
102 }; }G_STMT_END
104 /* 16 == default capacity */
105 #define mono_stringbuilder_capacity(sb) ((sb)->str ? ((sb)->str->length) : 16)
108 * Macros which cache the results of lookups locally.
109 * These should be used instead of the original versions, if the __GNUC__
110 * restriction is acceptable.
113 #ifdef __GNUC__
115 /* namespace and name should be a constant */
116 #define mono_class_from_name_cached(image,namespace,name) ({ \
117 static MonoClass *tmp_klass; \
118 if (!tmp_klass) { \
119 tmp_klass = mono_class_from_name ((image), (namespace), (name)); \
120 g_assert (tmp_klass); \
121 }; \
122 tmp_klass; })
123 /* name should be a compile-time constant */
124 #define mono_class_get_field_from_name_cached(klass,name) ({ \
125 static MonoClassField *tmp_field; \
126 if (!tmp_field) { \
127 tmp_field = mono_class_get_field_from_name ((klass), (name)); \
128 g_assert (tmp_field); \
129 }; \
130 tmp_field; })
131 /* eclass should be a run-time constant */
132 #define mono_array_class_get_cached(eclass,rank) ({ \
133 static MonoClass *tmp_klass; \
134 if (!tmp_klass) { \
135 tmp_klass = mono_array_class_get ((eclass), (rank)); \
136 g_assert (tmp_klass); \
137 }; \
138 tmp_klass; })
139 /* eclass should be a run-time constant */
140 #define mono_array_new_cached(domain, eclass, size) mono_array_new_specific (mono_class_vtable ((domain), mono_array_class_get_cached ((eclass), 1)), (size))
142 #else
144 #define mono_class_from_name_cached(image,namespace,name) mono_class_from_name ((image), (namespace), (name))
145 #define mono_class_get_field_from_name_cached(klass,name) mono_class_get_field_from_name ((klass), (name))
146 #define mono_array_class_get_cached(eclass,rank) mono_array_class_get ((eclass), (rank))
147 #define mono_array_new_cached(domain, eclass, size) mono_array_new_specific (mono_class_vtable ((domain), mono_array_class_get_cached ((eclass), 1)), (size))
149 #endif
151 typedef struct {
152 MonoObject obj;
153 MonoObject *identity;
154 } MonoMarshalByRefObject;
156 /* This is a copy of System.AppDomain */
157 struct _MonoAppDomain {
158 MonoMarshalByRefObject mbr;
159 MonoDomain *data;
162 typedef struct {
163 MonoObject object;
164 gint32 length;
165 MonoString *str;
166 MonoString *cached_str;
167 gint32 max_capacity;
168 } MonoStringBuilder;
170 typedef struct {
171 MonoType *type;
172 gpointer value;
173 MonoClass *klass;
174 } MonoTypedRef;
176 typedef struct {
177 gpointer args;
178 } MonoArgumentHandle;
180 typedef struct {
181 MonoMethodSignature *sig;
182 gpointer args;
183 gint32 next_arg;
184 gint32 num_args;
185 } MonoArgIterator;
187 struct _MonoException {
188 MonoObject object;
189 /* Stores the IPs and the generic sharing infos
190 (vtable/MRGCTX) of the frames. */
191 MonoArray *trace_ips;
192 MonoObject *inner_ex;
193 MonoString *message;
194 MonoString *help_link;
195 MonoString *class_name;
196 MonoString *stack_trace;
197 MonoString *remote_stack_trace;
198 gint32 remote_stack_index;
199 gint32 hresult;
200 MonoString *source;
201 MonoObject *_data;
204 typedef struct {
205 MonoException base;
206 } MonoSystemException;
208 typedef struct {
209 MonoSystemException base;
210 MonoString *param_name;
211 } MonoArgumentException;
213 typedef struct {
214 MonoSystemException base;
215 MonoString *msg;
216 MonoString *type_name;
217 } MonoTypeLoadException;
219 typedef struct {
220 MonoObject object;
221 MonoObject *async_state;
222 MonoObject *handle;
223 MonoObject *async_delegate;
224 gpointer *data;
225 MonoObject *object_data;
226 MonoBoolean sync_completed;
227 MonoBoolean completed;
228 MonoBoolean endinvoke_called;
229 MonoObject *async_callback;
230 MonoObject *execution_context;
231 MonoObject *original_context;
232 } MonoAsyncResult;
234 typedef struct {
235 MonoMarshalByRefObject object;
236 gpointer handle;
237 MonoBoolean disposed;
238 } MonoWaitHandle;
240 /* This is a copy of System.Runtime.Remoting.Messaging.CallType */
241 typedef enum {
242 CallType_Sync = 0,
243 CallType_BeginInvoke = 1,
244 CallType_EndInvoke = 2,
245 CallType_OneWay = 3
246 } MonoCallType;
248 /* This corresponds to System.Type */
249 struct _MonoReflectionType {
250 MonoObject object;
251 MonoType *type;
254 typedef struct {
255 MonoReflectionType type;
256 MonoObject *type_info;
257 } MonoReflectionMonoType;
259 typedef struct {
260 MonoObject object;
261 MonoReflectionType *class_to_proxy;
262 MonoObject *context;
263 MonoObject *unwrapped_server;
264 gint32 target_domain_id;
265 MonoString *target_uri;
266 MonoObject *object_identity;
267 MonoObject *obj_TP;
268 MonoObject *stub_data;
269 } MonoRealProxy;
271 typedef struct {
272 MonoMarshalByRefObject object;
273 gpointer iunknown;
274 GHashTable* itf_hash;
275 } MonoComObject;
277 typedef struct {
278 MonoRealProxy real_proxy;
279 MonoComObject *com_object;
280 gint32 ref_count;
281 } MonoComInteropProxy;
283 typedef struct {
284 MonoObject object;
285 MonoRealProxy *rp;
286 MonoRemoteClass *remote_class;
287 MonoBoolean custom_type_info;
288 } MonoTransparentProxy;
290 typedef struct {
291 MonoObject obj;
292 MonoReflectionMethod *method;
293 MonoArray *args;
294 MonoArray *names;
295 MonoArray *arg_types;
296 MonoObject *ctx;
297 MonoObject *rval;
298 MonoObject *exc;
299 MonoAsyncResult *async_result;
300 guint32 call_type;
301 } MonoMethodMessage;
303 typedef struct {
304 MonoObject obj;
305 gint32 il_offset;
306 gint32 native_offset;
307 MonoReflectionMethod *method;
308 MonoString *filename;
309 gint32 line;
310 gint32 column;
311 MonoString *internal_method_name;
312 } MonoStackFrame;
314 typedef enum {
315 MONO_THREAD_FLAG_DONT_MANAGE = 1, // Don't wait for or abort this thread
316 } MonoThreadFlags;
318 struct _MonoInternalThread {
319 MonoObject obj;
320 int lock_thread_id; /* to be used as the pre-shifted thread id in thin locks */
321 HANDLE handle;
322 MonoArray *cached_culture_info;
323 gpointer unused1;
324 MonoBoolean threadpool_thread;
325 gunichar2 *name;
326 guint32 name_len;
327 guint32 state;
328 MonoException *abort_exc;
329 int abort_state_handle;
330 guint64 tid; /* This is accessed as a gsize in the code (so it can hold a 64bit pointer on systems that need it), but needs to reserve 64 bits of space on all machines as it corresponds to a field in managed code */
331 HANDLE start_notify;
332 gpointer stack_ptr;
333 gpointer *static_data;
334 gpointer jit_data;
335 gpointer lock_data;
336 MonoAppContext *current_appcontext;
337 int stack_size;
338 GSList *appdomain_refs;
339 /* This is modified using atomic ops, so keep it a gint32 */
340 gint32 interruption_requested;
341 gpointer suspend_event;
342 gpointer suspended_event;
343 gpointer resume_event;
344 CRITICAL_SECTION *synch_cs;
345 MonoBoolean thread_dump_requested;
346 gpointer end_stack; /* This is only used when running in the debugger. */
347 MonoBoolean thread_interrupt_requested;
348 guint8 apartment_state;
349 gint32 critical_region_level;
350 guint32 small_id; /* A small, unique id, used for the hazard pointer table. */
351 MonoThreadManageCallback manage_callback;
352 MonoException *pending_exception;
353 MonoThread *root_domain_thread;
354 gpointer interrupt_on_stop;
355 gsize flags;
357 * These fields are used to avoid having to increment corlib versions
358 * when a new field is added to the unmanaged MonoThread structure.
360 gpointer unused4;
361 gpointer unused5;
362 gpointer unused6;
365 struct _MonoThread {
366 MonoObject obj;
367 struct _MonoInternalThread *internal_thread;
368 MonoObject *start_obj;
369 MonoObject *ec_to_set;
372 typedef struct {
373 MonoString *name;
374 MonoReflectionType *type;
375 MonoObject *value;
376 } MonoSerializationEntry;
378 typedef struct {
379 guint32 state;
380 MonoObject *additional;
381 } MonoStreamingContext;
383 typedef struct {
384 MonoObject obj;
385 MonoBoolean readOnly;
386 MonoString *AMDesignator;
387 MonoString *PMDesignator;
388 MonoString *DateSeparator;
389 MonoString *TimeSeparator;
390 MonoString *ShortDatePattern;
391 MonoString *LongDatePattern;
392 MonoString *ShortTimePattern;
393 MonoString *LongTimePattern;
394 MonoString *MonthDayPattern;
395 MonoString *YearMonthPattern;
396 MonoString *FullDateTimePattern;
397 MonoString *RFC1123Pattern;
398 MonoString *SortableDateTimePattern;
399 MonoString *UniversalSortableDateTimePattern;
400 guint32 FirstDayOfWeek;
401 MonoObject *Calendar;
402 guint32 CalendarWeekRule;
403 MonoArray *AbbreviatedDayNames;
404 MonoArray *DayNames;
405 MonoArray *MonthNames;
406 MonoArray *AbbreviatedMonthNames;
407 MonoArray *ShortDatePatterns;
408 MonoArray *LongDatePatterns;
409 MonoArray *ShortTimePatterns;
410 MonoArray *LongTimePatterns;
411 MonoArray *MonthDayPatterns;
412 MonoArray *YearMonthPatterns;
413 MonoArray *shortDayNames;
414 } MonoDateTimeFormatInfo;
416 typedef struct
418 MonoObject obj;
419 MonoBoolean readOnly;
420 MonoString *decimalFormats;
421 MonoString *currencyFormats;
422 MonoString *percentFormats;
423 MonoString *digitPattern;
424 MonoString *zeroPattern;
425 gint32 currencyDecimalDigits;
426 MonoString *currencyDecimalSeparator;
427 MonoString *currencyGroupSeparator;
428 MonoArray *currencyGroupSizes;
429 gint32 currencyNegativePattern;
430 gint32 currencyPositivePattern;
431 MonoString *currencySymbol;
432 MonoString *naNSymbol;
433 MonoString *negativeInfinitySymbol;
434 MonoString *negativeSign;
435 guint32 numberDecimalDigits;
436 MonoString *numberDecimalSeparator;
437 MonoString *numberGroupSeparator;
438 MonoArray *numberGroupSizes;
439 gint32 numberNegativePattern;
440 gint32 percentDecimalDigits;
441 MonoString *percentDecimalSeparator;
442 MonoString *percentGroupSeparator;
443 MonoArray *percentGroupSizes;
444 gint32 percentNegativePattern;
445 gint32 percentPositivePattern;
446 MonoString *percentSymbol;
447 MonoString *perMilleSymbol;
448 MonoString *positiveInfinitySymbol;
449 MonoString *positiveSign;
450 } MonoNumberFormatInfo;
452 typedef struct {
453 MonoObject obj;
454 gint32 lcid;
455 MonoString *icu_name;
456 gpointer ICU_collator;
457 } MonoCompareInfo;
459 typedef struct {
460 MonoObject obj;
461 MonoBoolean is_read_only;
462 gint32 lcid;
463 gint32 parent_lcid;
464 gint32 specific_lcid;
465 gint32 datetime_index;
466 gint32 number_index;
467 MonoBoolean use_user_override;
468 MonoNumberFormatInfo *number_format;
469 MonoDateTimeFormatInfo *datetime_format;
470 MonoObject *textinfo;
471 MonoString *name;
472 MonoString *displayname;
473 MonoString *englishname;
474 MonoString *nativename;
475 MonoString *iso3lang;
476 MonoString *iso2lang;
477 MonoString *icu_name;
478 MonoString *win3lang;
479 MonoString *territory;
480 MonoCompareInfo *compareinfo;
481 const gint32 *calendar_data;
482 const void* text_info_data;
483 } MonoCultureInfo;
485 typedef struct {
486 MonoObject obj;
487 gint32 region_id;
488 MonoString *iso2name;
489 MonoString *iso3name;
490 MonoString *win3name;
491 MonoString *english_name;
492 MonoString *currency_symbol;
493 MonoString *iso_currency_symbol;
494 MonoString *currency_english_name;
495 } MonoRegionInfo;
497 typedef struct {
498 MonoObject obj;
499 MonoString *str;
500 gint32 options;
501 MonoArray *key;
502 gint32 lcid;
503 } MonoSortKey;
505 typedef struct {
506 MonoObject object;
507 guint32 intType;
508 } MonoInterfaceTypeAttribute;
511 * Callbacks supplied by the runtime and called by the modules in metadata/
512 * This interface is easier to extend than adding a new function type +
513 * a new 'install' function for every callback.
515 typedef struct {
516 gpointer (*create_ftnptr) (MonoDomain *domain, gpointer addr);
517 gpointer (*get_addr_from_ftnptr) (gpointer descr);
518 char* (*get_runtime_build_info) (void);
519 gpointer (*get_vtable_trampoline) (int slot_index);
520 } MonoRuntimeCallbacks;
522 /* used to free a dynamic method */
523 typedef void (*MonoFreeMethodFunc) (MonoDomain *domain, MonoMethod *method);
525 /* Used to initialize the method pointers inside vtables */
526 typedef gboolean (*MonoInitVTableFunc) (MonoVTable *vtable);
528 void mono_set_pending_exception (MonoException *exc) MONO_INTERNAL;
530 /* remoting and async support */
532 MonoAsyncResult *
533 mono_async_result_new (MonoDomain *domain, HANDLE handle,
534 MonoObject *state, gpointer data, MonoObject *object_data) MONO_INTERNAL;
536 MonoWaitHandle *
537 mono_wait_handle_new (MonoDomain *domain, HANDLE handle) MONO_INTERNAL;
539 HANDLE
540 mono_wait_handle_get_handle (MonoWaitHandle *handle) MONO_INTERNAL;
542 void
543 mono_message_init (MonoDomain *domain, MonoMethodMessage *this_obj,
544 MonoReflectionMethod *method, MonoArray *out_args) MONO_INTERNAL;
546 MonoObject *
547 mono_remoting_invoke (MonoObject *real_proxy, MonoMethodMessage *msg,
548 MonoObject **exc, MonoArray **out_args) MONO_INTERNAL;
550 MonoObject *
551 mono_message_invoke (MonoObject *target, MonoMethodMessage *msg,
552 MonoObject **exc, MonoArray **out_args) MONO_INTERNAL;
554 MonoMethodMessage *
555 mono_method_call_message_new (MonoMethod *method, gpointer *params, MonoMethod *invoke,
556 MonoDelegate **cb, MonoObject **state) MONO_INTERNAL;
558 void
559 mono_method_return_message_restore (MonoMethod *method, gpointer *params, MonoArray *out_args) MONO_INTERNAL;
561 void
562 mono_delegate_ctor_with_method (MonoObject *this, MonoObject *target, gpointer addr, MonoMethod *method) MONO_INTERNAL;
564 void
565 mono_delegate_ctor (MonoObject *this_obj, MonoObject *target, gpointer addr) MONO_INTERNAL;
567 void*
568 mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *pass_size_in_words) MONO_INTERNAL;
570 void
571 mono_runtime_free_method (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL;
573 /* runtime initialization functions */
574 typedef void (*MonoExceptionFunc) (MonoException *ex);
576 void
577 mono_install_handler (MonoExceptionFunc func) MONO_INTERNAL;
579 void
580 mono_install_runtime_invoke (MonoInvokeFunc func) MONO_INTERNAL;
582 void
583 mono_install_compile_method (MonoCompileFunc func) MONO_INTERNAL;
585 void
586 mono_install_free_method (MonoFreeMethodFunc func) MONO_INTERNAL;
588 void
589 mono_install_callbacks (MonoRuntimeCallbacks *cbs) MONO_INTERNAL;
591 MonoRuntimeCallbacks*
592 mono_get_runtime_callbacks (void) MONO_INTERNAL;
594 void
595 mono_type_initialization_init (void) MONO_INTERNAL;
597 void
598 mono_type_initialization_cleanup (void) MONO_INTERNAL;
600 guint32
601 mono_thread_get_tls_key (void) MONO_INTERNAL;
603 gint32
604 mono_thread_get_tls_offset (void) MONO_INTERNAL;
606 guint32
607 mono_domain_get_tls_key (void) MONO_INTERNAL;
609 gint32
610 mono_domain_get_tls_offset (void) MONO_INTERNAL;
612 /* Reflection and Reflection.Emit support */
615 * Handling System.Type objects:
617 * Fields defined as System.Type in managed code should be defined as MonoObject*
618 * in unmanaged structures, and the monotype_cast () function should be used for
619 * casting them to MonoReflectionType* to avoid crashes/security issues when
620 * encountering instances of user defined subclasses of System.Type.
623 #define IS_MONOTYPE(obj) (!(obj) || (((MonoObject*)(obj))->vtable->klass->image == mono_defaults.corlib && ((MonoReflectionType*)(obj))->type != NULL))
626 * Make sure the argument, which should be a System.Type is a System.MonoType object
627 * or equivalent, and not an instance of
628 * a user defined subclass of System.Type. This should be used in places were throwing
629 * an exception is safe.
631 #define CHECK_MONOTYPE(obj) do { \
632 if (!IS_MONOTYPE (obj)) \
633 mono_raise_exception (mono_get_exception_not_supported ("User defined subclasses of System.Type are not yet supported")); \
634 } while (0)
636 /* This should be used for accessing members of Type[] arrays */
637 #define mono_type_array_get(arr,index) monotype_cast (mono_array_get ((arr), gpointer, (index)))
640 * Cast an object to MonoReflectionType, making sure it is a System.MonoType or
641 * a subclass of it.
643 static inline MonoReflectionType*
644 monotype_cast (MonoObject *obj)
646 g_assert (IS_MONOTYPE (obj));
648 return (MonoReflectionType*)obj;
652 * The following structure must match the C# implementation in our corlib.
655 struct _MonoReflectionMethod {
656 MonoObject object;
657 MonoMethod *method;
658 MonoString *name;
659 MonoReflectionType *reftype;
662 typedef struct _MonoReflectionGenericMethod MonoReflectionGenericMethod;
663 struct _MonoReflectionGenericMethod {
664 MonoReflectionMethod method;
667 struct _MonoDelegate {
668 MonoObject object;
669 /* The compiled code of the target method */
670 gpointer method_ptr;
671 /* The invoke code */
672 gpointer invoke_impl;
673 MonoObject *target;
674 MonoMethod *method;
675 gpointer delegate_trampoline;
677 * If non-NULL, this points to a memory location which stores the address of
678 * the compiled code of the method, or NULL if it is not yet compiled.
680 guint8 **method_code;
681 MonoReflectionMethod *method_info;
682 MonoReflectionMethod *original_method_info;
683 MonoObject *data;
686 typedef struct _MonoMulticastDelegate MonoMulticastDelegate;
687 struct _MonoMulticastDelegate {
688 MonoDelegate delegate;
689 MonoMulticastDelegate *prev;
692 struct _MonoReflectionField {
693 MonoObject object;
694 MonoClass *klass;
695 MonoClassField *field;
696 MonoString *name;
697 MonoReflectionType *type;
698 guint32 attrs;
701 struct _MonoReflectionProperty {
702 MonoObject object;
703 MonoClass *klass;
704 MonoProperty *property;
707 /*This is System.EventInfo*/
708 struct _MonoReflectionEvent {
709 MonoObject object;
710 MonoObject *cached_add_event;
713 typedef struct {
714 MonoReflectionEvent object;
715 MonoClass *klass;
716 MonoEvent *event;
717 } MonoReflectionMonoEvent;
719 typedef struct {
720 MonoObject object;
721 MonoReflectionType *ClassImpl;
722 MonoObject *DefaultValueImpl;
723 MonoObject *MemberImpl;
724 MonoString *NameImpl;
725 gint32 PositionImpl;
726 guint32 AttrsImpl;
727 MonoObject *MarshalAsImpl;
728 } MonoReflectionParameter;
730 struct _MonoReflectionMethodBody {
731 MonoObject object;
732 MonoArray *clauses;
733 MonoArray *locals;
734 MonoArray *il;
735 MonoBoolean init_locals;
736 guint32 local_var_sig_token;
737 guint32 max_stack;
740 struct _MonoReflectionAssembly {
741 MonoObject object;
742 MonoAssembly *assembly;
743 MonoObject *resolve_event_holder;
744 /* CAS related */
745 MonoObject *evidence; /* Evidence */
746 MonoObject *minimum; /* PermissionSet - for SecurityAction.RequestMinimum */
747 MonoObject *optional; /* PermissionSet - for SecurityAction.RequestOptional */
748 MonoObject *refuse; /* PermissionSet - for SecurityAction.RequestRefuse */
749 MonoObject *granted; /* PermissionSet - for the resolved assembly granted permissions */
750 MonoObject *denied; /* PermissionSet - for the resolved assembly denied permissions */
751 /* */
752 MonoBoolean from_byte_array;
753 MonoString *name;
756 typedef struct {
757 MonoReflectionType *utype;
758 MonoArray *values;
759 MonoArray *names;
760 } MonoEnumInfo;
762 typedef struct {
763 MonoReflectionType *parent;
764 MonoReflectionType *ret;
765 guint32 attrs;
766 guint32 implattrs;
767 guint32 callconv;
768 } MonoMethodInfo;
770 typedef struct {
771 MonoReflectionType *parent;
772 MonoString *name;
773 MonoReflectionMethod *get;
774 MonoReflectionMethod *set;
775 guint32 attrs;
776 } MonoPropertyInfo;
778 typedef struct {
779 MonoReflectionType *declaring_type;
780 MonoReflectionType *reflected_type;
781 MonoString *name;
782 MonoReflectionMethod *add_method;
783 MonoReflectionMethod *remove_method;
784 MonoReflectionMethod *raise_method;
785 guint32 attrs;
786 MonoArray *other_methods;
787 } MonoEventInfo;
789 typedef struct {
790 MonoString *name;
791 MonoString *name_space;
792 MonoReflectionType *etype;
793 MonoReflectionType *nested_in;
794 MonoReflectionAssembly *assembly;
795 guint32 rank;
796 MonoBoolean isprimitive;
797 } MonoTypeInfo;
799 typedef struct {
800 MonoObject *member;
801 gint32 code_pos;
802 } MonoReflectionILTokenInfo;
804 typedef struct {
805 MonoObject object;
806 MonoArray *code;
807 gint32 code_len;
808 gint32 max_stack;
809 gint32 cur_stack;
810 MonoArray *locals;
811 MonoArray *ex_handlers;
812 gint32 num_token_fixups;
813 MonoArray *token_fixups;
814 } MonoReflectionILGen;
816 typedef struct {
817 MonoArray *handlers;
818 gint32 start;
819 gint32 len;
820 gint32 label;
821 } MonoILExceptionInfo;
823 typedef struct {
824 MonoObject *extype;
825 gint32 type;
826 gint32 start;
827 gint32 len;
828 gint32 filter_offset;
829 } MonoILExceptionBlock;
831 typedef struct {
832 MonoObject object;
833 MonoObject *catch_type;
834 gint32 filter_offset;
835 gint32 flags;
836 gint32 try_offset;
837 gint32 try_length;
838 gint32 handler_offset;
839 gint32 handler_length;
840 } MonoReflectionExceptionHandlingClause;
842 typedef struct {
843 MonoObject object;
844 MonoReflectionType *local_type;
845 MonoBoolean is_pinned;
846 guint16 local_index;
847 } MonoReflectionLocalVariableInfo;
849 typedef struct {
851 * Must have the same layout as MonoReflectionLocalVariableInfo, since
852 * LocalBuilder inherits from it under net 2.0.
854 MonoObject object;
855 MonoObject *type;
856 MonoBoolean is_pinned;
857 guint16 local_index;
858 MonoString *name;
859 } MonoReflectionLocalBuilder;
861 typedef struct {
862 MonoObject object;
863 gint32 count;
864 gint32 type;
865 gint32 eltype;
866 MonoString *guid;
867 MonoString *mcookie;
868 MonoString *marshaltype;
869 MonoObject *marshaltyperef;
870 gint32 param_num;
871 MonoBoolean has_size;
872 } MonoReflectionMarshal;
874 typedef struct {
875 MonoObject object;
876 MonoObject* methodb;
877 MonoString *name;
878 MonoArray *cattrs;
879 MonoReflectionMarshal *marshal_info;
880 guint32 attrs;
881 int position;
882 guint32 table_idx;
883 MonoObject *def_value;
884 } MonoReflectionParamBuilder;
886 typedef struct {
887 MonoObject object;
888 MonoMethod *mhandle;
889 MonoReflectionILGen *ilgen;
890 MonoArray *parameters;
891 guint32 attrs;
892 guint32 iattrs;
893 guint32 table_idx;
894 guint32 call_conv;
895 MonoObject *type;
896 MonoArray *pinfo;
897 MonoArray *cattrs;
898 MonoBoolean init_locals;
899 MonoArray *param_modreq;
900 MonoArray *param_modopt;
901 MonoArray *permissions;
902 } MonoReflectionCtorBuilder;
904 typedef struct {
905 MonoObject object;
906 MonoMethod *mhandle;
907 MonoObject *rtype;
908 MonoArray *parameters;
909 guint32 attrs;
910 guint32 iattrs;
911 MonoString *name;
912 guint32 table_idx;
913 MonoArray *code;
914 MonoReflectionILGen *ilgen;
915 MonoObject *type;
916 MonoArray *pinfo;
917 MonoArray *cattrs;
918 MonoReflectionMethod *override_method;
919 MonoString *dll;
920 MonoString *dllentry;
921 guint32 charset;
922 guint32 extra_flags;
923 guint32 native_cc;
924 guint32 call_conv;
925 MonoBoolean init_locals;
926 MonoGenericContainer *generic_container;
927 MonoArray *generic_params;
928 MonoArray *return_modreq;
929 MonoArray *return_modopt;
930 MonoArray *param_modreq;
931 MonoArray *param_modopt;
932 MonoArray *permissions;
933 } MonoReflectionMethodBuilder;
935 typedef struct {
936 MonoObject object;
937 MonoMethod *mhandle;
938 MonoReflectionType *parent;
939 MonoReflectionType *ret;
940 MonoArray *parameters;
941 MonoString *name;
942 guint32 table_idx;
943 guint32 call_conv;
944 } MonoReflectionArrayMethod;
946 typedef struct {
947 MonoArray *data;
948 MonoString *name;
949 MonoString *filename;
950 guint32 attrs;
951 guint32 offset;
952 MonoObject *stream;
953 } MonoReflectionResource;
955 typedef struct {
956 guint32 res_type;
957 guint32 res_id;
958 guint32 lang_id;
959 MonoArray *res_data;
960 } MonoReflectionWin32Resource;
962 typedef struct {
963 guint32 action;
964 MonoString *pset;
965 } MonoReflectionPermissionSet;
967 typedef struct {
968 MonoReflectionAssembly assembly;
969 MonoDynamicAssembly *dynamic_assembly;
970 MonoReflectionMethod *entry_point;
971 MonoArray *modules;
972 MonoString *name;
973 MonoString *dir;
974 MonoArray *cattrs;
975 MonoArray *resources;
976 MonoArray *public_key;
977 MonoString *version;
978 MonoString *culture;
979 guint32 algid;
980 guint32 flags;
981 guint32 pekind;
982 MonoBoolean delay_sign;
983 guint32 access;
984 MonoArray *loaded_modules;
985 MonoArray *win32_resources;
986 /* CAS related */
987 MonoArray *permissions_minimum;
988 MonoArray *permissions_optional;
989 MonoArray *permissions_refused;
990 gint32 pe_kind;
991 gint32 machine;
992 MonoBoolean corlib_internal;
993 MonoArray *type_forwarders;
994 MonoArray *pktoken; /* as hexadecimal byte[] */
995 } MonoReflectionAssemblyBuilder;
997 typedef struct {
998 MonoObject object;
999 guint32 attrs;
1000 MonoObject *type;
1001 MonoString *name;
1002 MonoObject *def_value;
1003 gint32 offset;
1004 gint32 table_idx;
1005 MonoReflectionType *typeb;
1006 MonoArray *rva_data;
1007 MonoArray *cattrs;
1008 MonoReflectionMarshal *marshal_info;
1009 MonoClassField *handle;
1010 MonoArray *modreq;
1011 MonoArray *modopt;
1012 } MonoReflectionFieldBuilder;
1014 typedef struct {
1015 MonoObject object;
1016 guint32 attrs;
1017 MonoString *name;
1018 MonoObject *type;
1019 MonoArray *parameters;
1020 MonoArray *cattrs;
1021 MonoObject *def_value;
1022 MonoReflectionMethodBuilder *set_method;
1023 MonoReflectionMethodBuilder *get_method;
1024 gint32 table_idx;
1025 } MonoReflectionPropertyBuilder;
1027 struct _MonoReflectionModule {
1028 MonoObject obj;
1029 MonoImage *image;
1030 MonoReflectionAssembly *assembly;
1031 MonoString *fqname;
1032 MonoString *name;
1033 MonoString *scopename;
1034 MonoBoolean is_resource;
1035 guint32 token;
1038 typedef struct {
1039 MonoReflectionModule module;
1040 MonoDynamicImage *dynamic_image;
1041 gint32 num_types;
1042 MonoArray *types;
1043 MonoArray *cattrs;
1044 MonoArray *guid;
1045 guint32 table_idx;
1046 MonoReflectionAssemblyBuilder *assemblyb;
1047 MonoArray *global_methods;
1048 MonoArray *global_fields;
1049 gboolean is_main;
1050 MonoArray *resources;
1051 } MonoReflectionModuleBuilder;
1053 typedef struct {
1054 MonoReflectionType type;
1055 MonoString *name;
1056 MonoString *nspace;
1057 MonoObject *parent;
1058 MonoReflectionType *nesting_type;
1059 MonoArray *interfaces;
1060 gint32 num_methods;
1061 MonoArray *methods;
1062 MonoArray *ctors;
1063 MonoArray *properties;
1064 gint32 num_fields;
1065 MonoArray *fields;
1066 MonoArray *events;
1067 MonoArray *cattrs;
1068 MonoArray *subtypes;
1069 guint32 attrs;
1070 guint32 table_idx;
1071 MonoReflectionModuleBuilder *module;
1072 gint32 class_size;
1073 gint32 packing_size;
1074 MonoGenericContainer *generic_container;
1075 MonoArray *generic_params;
1076 MonoArray *permissions;
1077 MonoReflectionType *created;
1078 } MonoReflectionTypeBuilder;
1080 typedef struct {
1081 MonoReflectionType type;
1082 MonoReflectionType *element_type;
1083 int rank;
1084 } MonoReflectionArrayType;
1086 typedef struct {
1087 MonoReflectionType type;
1088 MonoReflectionType *element_type;
1089 } MonoReflectionDerivedType;
1091 typedef struct {
1092 MonoReflectionType type;
1093 MonoReflectionTypeBuilder *tbuilder;
1094 MonoReflectionMethodBuilder *mbuilder;
1095 MonoString *name;
1096 guint32 index;
1097 MonoReflectionType *base_type;
1098 MonoArray *iface_constraints;
1099 MonoArray *cattrs;
1100 guint32 attrs;
1101 } MonoReflectionGenericParam;
1103 typedef struct _MonoReflectionGenericClass MonoReflectionGenericClass;
1104 struct _MonoReflectionGenericClass {
1105 MonoReflectionType type;
1106 MonoReflectionType *generic_type; /*Can be either a MonoType or a TypeBuilder*/
1107 MonoArray *type_arguments;
1108 guint32 initialized;
1111 typedef struct {
1112 MonoObject obj;
1113 MonoString *name;
1114 MonoString *codebase;
1115 gint32 major, minor, build, revision;
1116 MonoObject *cultureInfo;
1117 guint32 flags;
1118 guint32 hashalg;
1119 MonoObject *keypair;
1120 MonoArray *publicKey;
1121 MonoArray *keyToken;
1122 guint32 versioncompat;
1123 MonoObject *version;
1124 guint32 processor_architecture;
1125 } MonoReflectionAssemblyName;
1127 typedef struct {
1128 MonoObject obj;
1129 MonoString *name;
1130 MonoReflectionType *type;
1131 MonoReflectionTypeBuilder *typeb;
1132 MonoArray *cattrs;
1133 MonoReflectionMethodBuilder *add_method;
1134 MonoReflectionMethodBuilder *remove_method;
1135 MonoReflectionMethodBuilder *raise_method;
1136 MonoArray *other_methods;
1137 guint32 attrs;
1138 guint32 table_idx;
1139 } MonoReflectionEventBuilder;
1141 typedef struct {
1142 MonoObject obj;
1143 MonoReflectionMethod *ctor;
1144 MonoArray *data;
1145 } MonoReflectionCustomAttr;
1147 typedef struct {
1148 MonoObject object;
1149 gint32 call_conv;
1150 gint32 charset;
1151 MonoString *dll;
1152 MonoString *entry_point;
1153 MonoBoolean exact_spelling;
1154 MonoBoolean preserve_sig;
1155 MonoBoolean set_last_error;
1156 MonoBoolean best_fit_mapping;
1157 MonoBoolean throw_on_unmappable;
1158 } MonoReflectionDllImportAttribute;
1160 typedef struct {
1161 MonoObject object;
1162 gint32 call_conv;
1163 gint32 charset;
1164 MonoBoolean set_last_error;
1165 MonoBoolean best_fit_mapping;
1166 MonoBoolean throw_on_unmappable;
1167 } MonoReflectionUnmanagedFunctionPointerAttribute;
1169 typedef struct {
1170 MonoObject object;
1171 MonoString *guid;
1172 } MonoReflectionGuidAttribute;
1174 typedef struct {
1175 MonoObject object;
1176 MonoMethod *mhandle;
1177 MonoString *name;
1178 MonoReflectionType *rtype;
1179 MonoArray *parameters;
1180 guint32 attrs;
1181 guint32 call_conv;
1182 MonoReflectionModule *module;
1183 MonoBoolean skip_visibility;
1184 MonoBoolean init_locals;
1185 MonoReflectionILGen *ilgen;
1186 gint32 nrefs;
1187 MonoArray *refs;
1188 GSList *referenced_by;
1189 MonoReflectionType *owner;
1190 } MonoReflectionDynamicMethod;
1192 typedef struct {
1193 MonoObject object;
1194 MonoReflectionModuleBuilder *module;
1195 MonoArray *arguments;
1196 guint32 type;
1197 MonoReflectionType *return_type;
1198 guint32 call_conv;
1199 guint32 unmanaged_call_conv;
1200 MonoArray *modreqs;
1201 MonoArray *modopts;
1202 } MonoReflectionSigHelper;
1204 typedef struct {
1205 MonoObject object;
1206 MonoReflectionGenericClass *inst;
1207 MonoObject *fb; /*can be either a MonoField or a FieldBuilder*/
1208 } MonoReflectionFieldOnTypeBuilderInst;
1210 typedef struct {
1211 MonoObject object;
1212 MonoReflectionGenericClass *inst;
1213 MonoObject *cb; /*can be either a MonoCMethod or ConstructorBuilder*/
1214 } MonoReflectionCtorOnTypeBuilderInst;
1216 typedef struct {
1217 MonoObject object;
1218 MonoReflectionType *inst;
1219 MonoObject *mb; /*can be either a MonoMethod or MethodBuilder*/
1220 MonoArray *method_args;
1221 MonoReflectionMethodBuilder *generic_method_definition;
1222 } MonoReflectionMethodOnTypeBuilderInst;
1224 typedef struct {
1225 MonoObject object;
1226 MonoBoolean visible;
1227 } MonoReflectionComVisibleAttribute;
1229 enum {
1230 RESOURCE_LOCATION_EMBEDDED = 1,
1231 RESOURCE_LOCATION_ANOTHER_ASSEMBLY = 2,
1232 RESOURCE_LOCATION_IN_MANIFEST = 4
1235 typedef struct {
1236 MonoObject object;
1237 MonoReflectionAssembly *assembly;
1238 MonoString *filename;
1239 guint32 location;
1240 } MonoManifestResourceInfo;
1242 /* A boxed IntPtr */
1243 typedef struct {
1244 MonoObject object;
1245 gpointer m_value;
1246 } MonoIntPtr;
1248 /* Keep in sync with System.GenericParameterAttributes */
1249 typedef enum {
1250 GENERIC_PARAMETER_ATTRIBUTE_NON_VARIANT = 0,
1251 GENERIC_PARAMETER_ATTRIBUTE_COVARIANT = 1,
1252 GENERIC_PARAMETER_ATTRIBUTE_CONTRAVARIANT = 2,
1253 GENERIC_PARAMETER_ATTRIBUTE_VARIANCE_MASK = 3,
1255 GENERIC_PARAMETER_ATTRIBUTE_NO_SPECIAL_CONSTRAINT = 0,
1256 GENERIC_PARAMETER_ATTRIBUTE_REFERENCE_TYPE_CONSTRAINT = 4,
1257 GENERIC_PARAMETER_ATTRIBUTE_VALUE_TYPE_CONSTRAINT = 8,
1258 GENERIC_PARAMETER_ATTRIBUTE_CONSTRUCTOR_CONSTRAINT = 16,
1259 GENERIC_PARAMETER_ATTRIBUTE_SPECIAL_CONSTRAINTS_MASK = 28
1260 } GenericParameterAttributes;
1262 typedef struct {
1263 MonoType *type;
1264 MonoClassField *field;
1265 MonoProperty *prop;
1266 } CattrNamedArg;
1268 void mono_image_create_pefile (MonoReflectionModuleBuilder *module, HANDLE file) MONO_INTERNAL;
1269 void mono_image_basic_init (MonoReflectionAssemblyBuilder *assembly) MONO_INTERNAL;
1270 MonoReflectionModule * mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *assembly, MonoString *file_name) MONO_INTERNAL;
1271 guint32 mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str) MONO_INTERNAL;
1272 guint32 mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, gboolean create_methodspec, gboolean register_token) MONO_INTERNAL;
1273 guint32 mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types) MONO_INTERNAL;
1274 void mono_image_module_basic_init (MonoReflectionModuleBuilder *module) MONO_INTERNAL;
1275 void mono_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj) MONO_INTERNAL;
1276 void mono_dynamic_image_free (MonoDynamicImage *image) MONO_INTERNAL;
1277 void mono_image_set_wrappers_type (MonoReflectionModuleBuilder *mb, MonoReflectionType *type) MONO_INTERNAL;
1279 void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
1281 void mono_reflection_create_internal_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
1283 void mono_reflection_setup_generic_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
1285 void mono_reflection_create_generic_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
1287 MonoReflectionType* mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
1289 void mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides) MONO_INTERNAL;
1291 void mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod *m) MONO_INTERNAL;
1292 void mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod *mb) MONO_INTERNAL;
1294 void mono_reflection_initialize_generic_parameter (MonoReflectionGenericParam *gparam) MONO_INTERNAL;
1295 void mono_reflection_create_unmanaged_type (MonoReflectionType *type) MONO_INTERNAL;
1296 void mono_reflection_register_with_runtime (MonoReflectionType *type) MONO_INTERNAL;
1298 void mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args, MonoArray **named_args, CattrNamedArg **named_arg_info) MONO_INTERNAL;
1300 MonoArray* mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass) MONO_INTERNAL;
1302 MonoClass*
1303 mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic) MONO_INTERNAL;
1304 MonoType*
1305 mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_argc, MonoType **types) MONO_INTERNAL;
1306 MonoReflectionMethod*
1307 mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *method, MonoArray *types) MONO_INTERNAL;
1308 void
1309 mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *methods, MonoArray *ctors, MonoArray *fields, MonoArray *properties, MonoArray *events) MONO_INTERNAL;
1310 MonoReflectionEvent *
1311 mono_reflection_event_builder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb) MONO_INTERNAL;
1313 MonoArray *mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig) MONO_INTERNAL;
1315 MonoArray *mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig) MONO_INTERNAL;
1317 MonoReflectionMarshal* mono_reflection_marshal_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec) MONO_INTERNAL;
1319 gpointer
1320 mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context) MONO_INTERNAL;
1322 gboolean
1323 mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass) MONO_INTERNAL;
1325 gboolean
1326 mono_reflection_is_valid_dynamic_token (MonoDynamicImage *image, guint32 token) MONO_INTERNAL;
1328 MonoType*
1329 mono_reflection_type_get_handle (MonoReflectionType *ref) MONO_INTERNAL;
1331 void
1332 mono_image_build_metadata (MonoReflectionModuleBuilder *module) MONO_INTERNAL;
1335 mono_get_constant_value_from_blob (MonoDomain* domain, MonoTypeEnum type, const char *blob, void *value) MONO_INTERNAL;
1337 void
1338 mono_release_type_locks (MonoInternalThread *thread) MONO_INTERNAL;
1340 char *
1341 mono_string_to_utf8_mp (MonoMemPool *mp, MonoString *s, MonoError *error) MONO_INTERNAL;
1343 char *
1344 mono_string_to_utf8_image (MonoImage *image, MonoString *s, MonoError *error) MONO_INTERNAL;
1347 MonoArray*
1348 mono_array_clone_in_domain (MonoDomain *domain, MonoArray *array) MONO_INTERNAL;
1350 void
1351 mono_array_full_copy (MonoArray *src, MonoArray *dest) MONO_INTERNAL;
1353 gboolean
1354 mono_array_calc_byte_len (MonoClass *class, mono_array_size_t len, mono_array_size_t *res) MONO_INTERNAL;
1356 gpointer
1357 mono_remote_class_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, MonoRealProxy *real_proxy) MONO_INTERNAL;
1359 void
1360 mono_upgrade_remote_class (MonoDomain *domain, MonoObject *tproxy, MonoClass *klass) MONO_INTERNAL;
1362 gpointer
1363 mono_create_ftnptr (MonoDomain *domain, gpointer addr) MONO_INTERNAL;
1365 gpointer
1366 mono_get_addr_from_ftnptr (gpointer descr) MONO_INTERNAL;
1368 void
1369 mono_nullable_init (guint8 *buf, MonoObject *value, MonoClass *klass) MONO_INTERNAL;
1371 MonoObject*
1372 mono_nullable_box (guint8 *buf, MonoClass *klass) MONO_INTERNAL;
1374 #ifdef MONO_SMALL_CONFIG
1375 #define MONO_IMT_SIZE 9
1376 #else
1377 #define MONO_IMT_SIZE 19
1378 #endif
1380 typedef union {
1381 int vtable_slot;
1382 gpointer target_code;
1383 } MonoImtItemValue;
1385 typedef struct _MonoImtBuilderEntry {
1386 gpointer key;
1387 struct _MonoImtBuilderEntry *next;
1388 MonoImtItemValue value;
1389 int children;
1390 guint8 has_target_code : 1;
1391 } MonoImtBuilderEntry;
1393 typedef struct _MonoIMTCheckItem MonoIMTCheckItem;
1395 struct _MonoIMTCheckItem {
1396 gpointer key;
1397 int check_target_idx;
1398 MonoImtItemValue value;
1399 guint8 *jmp_code;
1400 guint8 *code_target;
1401 guint8 is_equals;
1402 guint8 compare_done;
1403 guint8 chunk_size;
1404 guint8 short_branch;
1405 guint8 has_target_code;
1408 typedef gpointer (*MonoImtThunkBuilder) (MonoVTable *vtable, MonoDomain *domain,
1409 MonoIMTCheckItem **imt_entries, int count, gpointer fail_trunk);
1411 void
1412 mono_install_imt_thunk_builder (MonoImtThunkBuilder func) MONO_INTERNAL;
1414 void
1415 mono_install_imt_trampoline (gpointer tramp) MONO_INTERNAL;
1417 void
1418 mono_vtable_build_imt_slot (MonoVTable* vtable, int imt_slot) MONO_INTERNAL;
1420 guint32
1421 mono_method_get_imt_slot (MonoMethod *method) MONO_INTERNAL;
1423 void
1424 mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtable,
1425 gpointer *vtable_slot,
1426 MonoMethod *method, gpointer code) MONO_INTERNAL;
1428 gpointer
1429 mono_method_alloc_generic_virtual_thunk (MonoDomain *domain, int size) MONO_INTERNAL;
1431 typedef enum {
1432 MONO_UNHANDLED_POLICY_LEGACY,
1433 MONO_UNHANDLED_POLICY_CURRENT
1434 } MonoRuntimeUnhandledExceptionPolicy;
1436 MonoRuntimeUnhandledExceptionPolicy
1437 mono_runtime_unhandled_exception_policy_get (void) MONO_INTERNAL;
1438 void
1439 mono_runtime_unhandled_exception_policy_set (MonoRuntimeUnhandledExceptionPolicy policy) MONO_INTERNAL;
1441 MonoVTable *
1442 mono_class_try_get_vtable (MonoDomain *domain, MonoClass *class) MONO_INTERNAL;
1444 MonoException *
1445 mono_runtime_class_init_full (MonoVTable *vtable, gboolean raise_exception) MONO_INTERNAL;
1447 void
1448 mono_method_clear_object (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL;
1450 void
1451 mono_class_compute_gc_descriptor (MonoClass *class) MONO_INTERNAL;
1453 MonoObject*
1454 mono_object_xdomain_representation (MonoObject *obj, MonoDomain *target_domain, MonoObject **exc) MONO_INTERNAL;
1456 char *
1457 mono_string_to_utf8_checked (MonoString *s, MonoError *error) MONO_INTERNAL;
1459 gboolean
1460 mono_class_is_reflection_method_or_constructor (MonoClass *class) MONO_INTERNAL;
1462 MonoObject *
1463 mono_get_object_from_blob (MonoDomain *domain, MonoType *type, const char *blob) MONO_INTERNAL;
1465 gpointer
1466 mono_class_get_ref_info (MonoClass *klass) MONO_INTERNAL;
1468 void
1469 mono_class_set_ref_info (MonoClass *klass, gpointer obj) MONO_INTERNAL;
1471 void
1472 mono_class_free_ref_info (MonoClass *klass) MONO_INTERNAL;
1474 #endif /* __MONO_OBJECT_INTERNALS_H__ */