2007-07-22 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / metadata / class-internals.h
1 #ifndef __MONO_METADATA_CLASS_INTERBALS_H__
2 #define __MONO_METADATA_CLASS_INTERBALS_H__
3
4 #include <mono/metadata/class.h>
5 #include <mono/metadata/object.h>
6 #include <mono/io-layer/io-layer.h>
7 #include "mono/utils/mono-compiler.h"
8
9 #define MONO_CLASS_IS_ARRAY(c) ((c)->rank)
10
11 #define MONO_DEFAULT_SUPERTABLE_SIZE 6
12
13 extern gboolean mono_print_vtable;
14
15 typedef void     (*MonoStackWalkImpl) (MonoStackWalk func, gboolean do_il_offset, gpointer user_data);
16
17 typedef struct _MonoMethodNormal MonoMethodNormal;
18 typedef struct _MonoMethodWrapper MonoMethodWrapper;
19 typedef struct _MonoMethodInflated MonoMethodInflated;
20 typedef struct _MonoMethodPInvoke MonoMethodPInvoke;
21
22 typedef enum {
23 #define WRAPPER(e,n) MONO_WRAPPER_ ## e,
24 #include "wrapper-types.h"
25 #undef WRAPPER
26         MONO_WRAPPER_NUM
27 } MonoWrapperType;
28
29 typedef enum {
30         MONO_TYPE_NAME_FORMAT_IL,
31         MONO_TYPE_NAME_FORMAT_REFLECTION,
32         MONO_TYPE_NAME_FORMAT_FULL_NAME,
33         MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
34 } MonoTypeNameFormat;
35
36 typedef enum {
37         MONO_REMOTING_TARGET_UNKNOWN,
38         MONO_REMOTING_TARGET_APPDOMAIN,
39         MONO_REMOTING_TARGET_COMINTEROP
40 } MonoRemotingTarget;
41
42 struct _MonoMethod {
43         guint16 flags;  /* method flags */
44         guint16 iflags; /* method implementation flags */
45         guint32 token;
46         MonoClass *klass;
47         MonoMethodSignature *signature;
48         MonoGenericContainer *generic_container;
49         /* name is useful mostly for debugging */
50         const char *name;
51         /* this is used by the inlining algorithm */
52         unsigned int inline_info:1;
53         unsigned int uses_this:1;
54         unsigned int wrapper_type:5;
55         unsigned int string_ctor:1;
56         unsigned int save_lmf:1;
57         unsigned int dynamic:1; /* created & destroyed during runtime */
58         unsigned int is_inflated:1; /* whether we're a MonoMethodInflated */
59         unsigned int skip_visibility:1; /* whenever to skip JIT visibility checks */
60         signed int slot : 20;
61 };
62
63 struct _MonoMethodNormal {
64         MonoMethod method;
65         MonoMethodHeader *header;
66 };
67
68 struct _MonoMethodWrapper {
69         MonoMethodNormal method;
70         void *method_data;
71 };
72
73 struct _MonoMethodPInvoke {
74         MonoMethod method;
75         gpointer addr;
76         /* add marshal info */
77         guint16 piflags;  /* pinvoke flags */
78         guint16 implmap_idx;  /* index into IMPLMAP */
79 };
80
81 typedef struct {
82         MonoType *generic_type;
83         gpointer reflection_info;
84 } MonoInflatedField;
85
86 /*
87  * MonoClassField is just a runtime representation of the metadata for
88  * field, it doesn't contain the data directly.  Static fields are
89  * stored in MonoVTable->data.  Instance fields are allocated in the
90  * objects after the object header.
91  */
92 struct _MonoClassField {
93         /* Type of the field */
94         MonoType        *type;
95
96         /* If this is an instantiated generic type, this is the
97          * "original" type, ie. the MONO_TYPE_VAR or MONO_TYPE_GENERICINST
98          * it was instantiated from.
99          */
100         MonoInflatedField  *generic_info;
101
102         /*
103          * Offset where this field is stored; if it is an instance
104          * field, it's the offset from the start of the object, if
105          * it's static, it's from the start of the memory chunk
106          * allocated for statics for the class.
107          */
108         int              offset;
109
110         const char      *name;
111
112         /*
113          * If the field is constant, pointer to the metadata constant
114          * value.
115          * If the field has an RVA flag, pointer to the data.
116          * Else, invalid.
117          */
118         const char      *data;
119
120         /* Type where the field was defined */
121         MonoClass       *parent;
122
123         /*
124          * If the field is constant, the type of the constant.
125          */
126         MonoTypeEnum     def_type;
127 };
128
129 /* a field is ignored if it's named "_Deleted" and it has the specialname and rtspecialname flags set */
130 #define mono_field_is_deleted(field) (((field)->type->attrs & (FIELD_ATTRIBUTE_SPECIAL_NAME | FIELD_ATTRIBUTE_RT_SPECIAL_NAME)) \
131                                       && (strcmp ((field)->name, "_Deleted") == 0))
132
133 typedef struct {
134         MonoClassField *field;
135         guint32 offset;
136         MonoMarshalSpec *mspec;
137 } MonoMarshalField;
138
139 typedef struct {
140         guint32 native_size;
141         guint32 num_fields;
142         MonoMethod *ptr_to_str;
143         MonoMethod *str_to_ptr;
144         MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
145 } MonoMarshalType;
146
147 struct _MonoProperty {
148         MonoClass *parent;
149         const char *name;
150         MonoMethod *get;
151         MonoMethod *set;
152         guint32 attrs;
153 };
154
155 struct _MonoEvent {
156         MonoClass *parent;
157         const char *name;
158         MonoMethod *add;
159         MonoMethod *remove;
160         MonoMethod *raise;
161         MonoMethod **other;
162         guint32 attrs;
163 };
164
165 /* type of exception being "on hold" for later processing (see exception_type) */
166 enum {
167         MONO_EXCEPTION_NONE = 0,
168         MONO_EXCEPTION_SECURITY_LINKDEMAND = 1,
169         MONO_EXCEPTION_SECURITY_INHERITANCEDEMAND = 2,
170         MONO_EXCEPTION_INVALID_PROGRAM = 3,
171         MONO_EXCEPTION_UNVERIFIABLE_IL = 4,
172         MONO_EXCEPTION_MISSING_METHOD = 5,
173         MONO_EXCEPTION_MISSING_FIELD = 6,
174         MONO_EXCEPTION_TYPE_LOAD = 7,
175         MONO_EXCEPTION_FILE_NOT_FOUND = 8
176         /* add other exception type */
177 };
178
179 /* This struct collects the info needed for the runtime use of a class,
180  * like the vtables for a domain, the GC descriptor, etc.
181  */
182 typedef struct {
183         guint16 max_domain;
184         /* domain_vtables is indexed by the domain id and the size is max_domain + 1 */
185         MonoVTable *domain_vtables [MONO_ZERO_LEN_ARRAY];
186 } MonoClassRuntimeInfo;
187
188 struct _MonoClass {
189         MonoImage *image;
190
191         /* The underlying type of the enum */
192         MonoType *enum_basetype;
193         /* element class for arrays and enum */
194         MonoClass *element_class; 
195         /* used for subtype checks */
196         MonoClass *cast_class; 
197         /* array dimension */
198         guint8     rank;          
199
200         guint inited          : 1;
201         /* We use init_pending to detect cyclic calls to mono_class_init */
202         guint init_pending    : 1;
203
204         /* A class contains static and non static data. Static data can be
205          * of the same type as the class itselfs, but it does not influence
206          * the instance size of the class. To avoid cyclic calls to 
207          * mono_class_init (from mono_class_instance_size ()) we first 
208          * initialise all non static fields. After that we set size_inited 
209          * to 1, because we know the instance size now. After that we 
210          * initialise all static fields.
211          */
212         guint size_inited     : 1;
213         guint valuetype       : 1; /* derives from System.ValueType */
214         guint enumtype        : 1; /* derives from System.Enum */
215         guint blittable       : 1; /* class is blittable */
216         guint unicode         : 1; /* class uses unicode char when marshalled */
217         guint wastypebuilder  : 1; /* class was created at runtime from a TypeBuilder */
218         /* next byte */
219         guint min_align       : 4;
220         guint packing_size    : 4;
221         /* next byte */
222         guint ghcimpl         : 1; /* class has its own GetHashCode impl */ 
223         guint has_finalize    : 1; /* class has its own Finalize impl */ 
224         guint marshalbyref    : 1; /* class is a MarshalByRefObject */
225         guint contextbound    : 1; /* class is a ContextBoundObject */
226         guint delegate        : 1; /* class is a Delegate */
227         guint gc_descr_inited : 1; /* gc_descr is initialized */
228         guint has_cctor       : 1; /* class has a cctor */
229         guint has_references  : 1; /* it has GC-tracked references in the instance */
230         /* next byte */
231         guint has_static_refs : 1; /* it has static fields that are GC-tracked */
232         guint no_special_static_fields : 1; /* has no thread/context static fields */
233         /* directly or indirectly derives from ComImport attributed class.
234          * this means we need to create a proxy for instances of this class
235          * for COM Interop. set this flag on loading so all we need is a quick check
236          * during object creation rather than having to traverse supertypes
237          */
238         guint is_com_object : 1; 
239
240         guint8     exception_type;      /* MONO_EXCEPTION_* */
241         void*      exception_data;      /* Additional information about the exception */
242         guint32    declsec_flags;       /* declarative security attributes flags */
243
244         MonoClass  *parent;
245         MonoClass  *nested_in;
246         GList      *nested_classes;
247
248         guint32    type_token;
249         const char *name;
250         const char *name_space;
251         
252         /* for fast subtype checks */
253         MonoClass **supertypes;
254         guint16     idepth;
255
256         guint16     interface_count;
257         guint16     interface_id;        /* unique inderface id (for interfaces) */
258         guint16     max_interface_id;
259         
260         guint16     interface_offsets_count;
261         MonoClass **interfaces_packed;
262         guint16    *interface_offsets_packed;
263         guint8     *interface_bitmap;
264         
265         MonoClass **interfaces;
266
267         /*
268          * Computed object instance size, total.
269          */
270         int        instance_size;
271         int        vtable_size; /* number of slots */
272         union {
273                 int class_size; /* size of area for static fields */
274                 int element_size; /* for array types */
275         } sizes;
276
277         /*
278          * From the TypeDef table
279          */
280         guint32    flags;
281         struct {
282                 guint32 first, count;
283         } field, method, property, event;
284
285         /* loaded on demand */
286         MonoMarshalType *marshal_info;
287
288         /*
289          * Field information: Type and location from object base
290          */
291         MonoClassField *fields;
292
293         /* Initialized by a call to mono_class_setup_properties () */
294         MonoProperty *properties;
295
296         /* Initialized by a call to mono_class_setup_events () */
297         MonoEvent *events;
298
299         MonoMethod **methods;
300
301         /* used as the type of the this argument and when passing the arg by value */
302         MonoType this_arg;
303         MonoType byval_arg;
304
305         MonoGenericClass *generic_class;
306         MonoGenericContainer *generic_container;
307
308         void *reflection_info;
309
310         void *gc_descr;
311
312         MonoClassRuntimeInfo *runtime_info;
313
314         /* next element in the class_cache hash list (in MonoImage) */
315         MonoClass *next_class_cache;
316
317         /* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
318         MonoMethod **vtable;    
319 };
320
321 #define MONO_CLASS_IMPLEMENTS_INTERFACE(k,uiid) (((uiid) <= (k)->max_interface_id) && ((k)->interface_bitmap [(uiid) >> 3] & (1 << ((uiid)&7))))
322 int mono_class_interface_offset (MonoClass *klass, MonoClass *itf);
323
324 /* the interface_offsets array is stored in memory before this struct */
325 struct MonoVTable {
326         MonoClass  *klass;
327          /*
328          * According to comments in gc_gcj.h, this should be the second word in
329          * the vtable.
330          */
331         void *gc_descr;         
332         MonoDomain *domain;  /* each object/vtable belongs to exactly one domain */
333         gpointer    data; /* to store static class data */
334         gpointer    type; /* System.Type type for klass */
335         guint8     *interface_bitmap;
336         guint16     max_interface_id;
337         guint8      rank;
338         guint remote          : 1; /* class is remotely activated */
339         guint initialized     : 1; /* cctor has been run */
340         guint init_failed     : 1; /* cctor execution failed */
341         guint32     imt_collisions_bitmap;
342         /* do not add any fields after vtable, the structure is dynamically extended */
343         gpointer    vtable [MONO_ZERO_LEN_ARRAY];       
344 };
345
346 #define MONO_VTABLE_IMPLEMENTS_INTERFACE(vt,uiid) (((uiid) <= (vt)->max_interface_id) && ((vt)->interface_bitmap [(uiid) >> 3] & (1 << ((uiid)&7))))
347
348 /*
349  * Generic instantiation data type encoding.
350  */
351
352 /*
353  * A particular generic instantiation:
354  *
355  * All instantiations are cached and we don't distinguish between class and method
356  * instantiations here.
357  */
358 struct _MonoGenericInst {
359         guint id;                       /* unique ID for debugging */
360         guint type_argc    : 22;        /* number of type arguments */
361         guint is_open      :  1;        /* if this is an open type */
362         MonoType **type_argv;
363 };
364
365 /*
366  * The generic context: an instantiation of a set of class and method generic parameters.
367  *
368  * NOTE: Never allocate this directly on the heap.  It have to be either allocated on the stack,
369  *       or embedded within other objects.  Don't store pointers to this, because it may be on the stack.
370  *       If you really have to, ensure you store a pointer to the embedding object along with it.
371  */
372 struct _MonoGenericContext {
373         /* The instantiation corresponding to the class generic parameters */
374         MonoGenericInst *class_inst;
375         /* The instantiation corresponding to the method generic parameters */
376         MonoGenericInst *method_inst;
377 };
378
379 /*
380  * Inflated generic method.
381  */
382 struct _MonoMethodInflated {
383         union {
384                 MonoMethod method;
385                 MonoMethodNormal normal;
386                 MonoMethodPInvoke pinvoke;
387         } method;
388         MonoMethod *declaring;          /* the generic method definition. */
389         MonoGenericContext context;     /* The current instantiation */
390         gpointer reflection_info;
391 };
392
393 /*
394  * A particular instantiation of a generic type.
395  */
396 struct _MonoGenericClass {
397         MonoClass *container_class;     /* the generic type definition */
398         MonoGenericContext context;     /* a context that contains the type instantiation doesn't contain any method instantiation */
399         guint is_dynamic  : 1;          /* We're a MonoDynamicGenericClass */
400         MonoClass *cached_class;        /* if present, the MonoClass corresponding to the instantiation.  */
401 };
402
403 /*
404  * This is used when instantiating a generic type definition which is
405  * a TypeBuilder.
406  */
407 struct _MonoDynamicGenericClass {
408         MonoGenericClass generic_class;
409         int count_methods;
410         MonoMethod **methods;
411         int count_ctors;
412         MonoMethod **ctors;
413         int count_fields;
414         MonoClassField *fields;
415         int count_properties;
416         MonoProperty *properties;
417         int count_events;
418         MonoEvent *events;
419         guint initialized;
420 };
421
422 /*
423  * The generic container.
424  *
425  * Stores the type parameters of a generic type definition or a generic method definition.
426  */
427 struct _MonoGenericContainer {
428         MonoGenericContext context;
429         /* If we're a generic method definition in a generic type definition,
430            the generic container of the containing class. */
431         MonoGenericContainer *parent;
432         /* If we're a generic method definition, caches all their instantiations. */
433         GHashTable *method_hash;
434         /* the generic type definition or the generic method definition corresponding to this container */
435         union {
436                 MonoClass *klass;
437                 MonoMethod *method;
438         } owner;
439         int type_argc    : 31;
440         /* If true, we're a generic method, otherwise a generic type definition. */
441         /* Invariant: parent != NULL => is_method */
442         int is_method    : 1;
443         /* Our type parameters. */
444         MonoGenericParam *type_params;
445 };
446
447 /*
448  * A type parameter.
449  */
450 struct _MonoGenericParam {
451         MonoGenericContainer *owner;    /* Type or method this parameter was defined in. */
452         MonoClass *pklass;              /* The corresponding `MonoClass'. */
453         const char *name;
454         guint16 flags;
455         guint16 num;
456         MonoClass** constraints; /* NULL means end of list */
457 };
458
459 /*
460  * Class information which might be cached by the runtime in the AOT file for
461  * example. Caching this allows us to avoid computing a generic vtable
462  * (class->vtable) in most cases, saving time and avoiding creation of lots of
463  * MonoMethod structures.
464  */
465 typedef struct MonoCachedClassInfo {
466         guint32 vtable_size;
467         guint has_finalize : 1;
468         guint ghcimpl : 1;
469         guint has_cctor : 1;
470         guint has_nested_classes : 1;
471         guint blittable : 1;
472         guint has_references : 1;
473         guint has_static_refs : 1;
474         guint no_special_static_fields : 1;
475         guint32 cctor_token;
476         MonoImage *finalize_image;
477         guint32 finalize_token;
478         guint32 instance_size;
479         guint32 class_size;
480         guint32 packing_size;
481         guint32 min_align;
482 } MonoCachedClassInfo;
483
484 typedef struct {
485         const char *name;
486         gconstpointer func;
487         gconstpointer wrapper;
488         gconstpointer trampoline;
489         MonoMethodSignature *sig;
490 } MonoJitICallInfo;
491
492 typedef struct {
493         guint8 exception_type;
494         char *class_name; /* If kind == TYPE */
495         char *assembly_name; /* If kind == TYPE or ASSEMBLY */
496         MonoClass *klass; /* If kind != TYPE */
497         const char *member_name; /* If kind != TYPE */
498         gboolean ref_only; /* If kind == ASSEMBLY */
499 } MonoLoaderError;
500
501 #define mono_class_has_parent(klass,parent) (((klass)->idepth >= (parent)->idepth) && ((klass)->supertypes [(parent)->idepth - 1] == (parent)))
502
503 typedef struct {
504         gulong new_object_count;
505         gulong initialized_class_count;
506         gulong generic_vtable_count;
507         gulong used_class_count;
508         gulong method_count;
509         gulong class_vtable_size;
510         gulong class_static_data_size;
511         gulong generic_instance_count;
512         gulong generic_class_count;
513         gulong inflated_method_count;
514         gulong inflated_method_count_2;
515         gulong inflated_type_count;
516         gulong generics_metadata_size;
517         gulong dynamic_code_alloc_count;
518         gulong dynamic_code_bytes_count;
519         gulong dynamic_code_frees_count;
520         gulong imt_tables_size;
521         gulong imt_number_of_tables;
522         gulong imt_number_of_methods;
523         gulong imt_used_slots;
524         gulong imt_slots_with_collisions;
525         gulong imt_max_collisions_in_slot;
526         gulong imt_method_count_when_max_collisions;
527         gulong imt_thunks_size;
528         gboolean enabled;
529 } MonoStats;
530
531 /*
532  * The definition of the first field in SafeHandle,
533  * Keep in sync with SafeHandle.cs, this is only used
534  * to access the `handle' parameter.
535  */
536 typedef struct {
537         MonoObject  base;
538         void       *handle;
539 } MonoSafeHandle;
540
541 /*
542  * Keep in sync with HandleRef.cs
543  */
544 typedef struct {
545         MonoObject *wrapper;
546         void       *handle;
547 } MonoHandleRef;
548
549 extern MonoStats mono_stats MONO_INTERNAL;
550
551 typedef gpointer (*MonoTrampoline)       (MonoMethod *method);
552 typedef gpointer (*MonoRemotingTrampoline)       (MonoMethod *method, MonoRemotingTarget target);
553 typedef gpointer (*MonoDelegateTrampoline)       (MonoClass *klass);
554
555 typedef gpointer (*MonoLookupDynamicToken) (MonoImage *image, guint32 token, MonoClass **handle_class);
556
557 typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
558
559 typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
560
561 void
562 mono_classes_init (void) MONO_INTERNAL;
563
564 void
565 mono_classes_cleanup (void) MONO_INTERNAL;
566
567 void
568 mono_class_layout_fields   (MonoClass *klass) MONO_INTERNAL;
569
570 void
571 mono_class_setup_interface_offsets (MonoClass *klass) MONO_INTERNAL;
572
573 void
574 mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int onum) MONO_INTERNAL;
575
576 void
577 mono_class_setup_vtable (MonoClass *klass) MONO_INTERNAL;
578
579 void
580 mono_class_setup_methods (MonoClass *klass) MONO_INTERNAL;
581
582 void
583 mono_class_setup_mono_type (MonoClass *klass) MONO_INTERNAL;
584
585 void
586 mono_class_setup_parent    (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
587
588 void
589 mono_class_setup_supertypes (MonoClass *klass) MONO_INTERNAL;
590
591 GPtrArray*
592 mono_class_get_implemented_interfaces (MonoClass *klass) MONO_INTERNAL;
593
594 gboolean
595 mono_class_is_open_constructed_type (MonoType *t) MONO_INTERNAL;
596
597 gboolean
598 mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides,
599                                MonoGenericContext *generic_context) MONO_INTERNAL;
600
601 MonoMethod*
602 mono_class_get_cctor (MonoClass *klass) MONO_INTERNAL;
603
604 MonoMethod*
605 mono_class_get_finalizer (MonoClass *klass) MONO_INTERNAL;
606
607 gboolean
608 mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller) MONO_INTERNAL;
609
610 gboolean
611 mono_class_has_special_static_fields (MonoClass *klass) MONO_INTERNAL;
612
613 void
614 mono_install_trampoline (MonoTrampoline func) MONO_INTERNAL;
615
616 void
617 mono_install_remoting_trampoline (MonoRemotingTrampoline func) MONO_INTERNAL;
618
619 void
620 mono_install_delegate_trampoline (MonoDelegateTrampoline func) MONO_INTERNAL;
621
622 gpointer
623 mono_lookup_dynamic_token (MonoImage *image, guint32 token) MONO_INTERNAL;
624
625 gpointer
626 mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, MonoClass **handle_class) MONO_INTERNAL;
627
628 void
629 mono_install_lookup_dynamic_token (MonoLookupDynamicToken func) MONO_INTERNAL;
630
631 void
632 mono_install_get_cached_class_info (MonoGetCachedClassInfo func) MONO_INTERNAL;
633
634 void
635 mono_install_get_class_from_name (MonoGetClassFromName func) MONO_INTERNAL;
636
637 MonoGenericContext*
638 mono_class_get_context (MonoClass *class) MONO_INTERNAL;
639
640 MonoGenericContext*
641 mono_method_get_context (MonoMethod *method) MONO_INTERNAL;
642
643 MonoGenericContext*
644 mono_generic_class_get_context (MonoGenericClass *gclass) MONO_INTERNAL;
645
646 MonoClass*
647 mono_generic_class_get_class (MonoGenericClass *gclass) MONO_INTERNAL;
648
649 MonoMethod*
650 mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context);
651
652
653 typedef struct {
654         MonoImage *corlib;
655         MonoClass *object_class;
656         MonoClass *byte_class;
657         MonoClass *void_class;
658         MonoClass *boolean_class;
659         MonoClass *sbyte_class;
660         MonoClass *int16_class;
661         MonoClass *uint16_class;
662         MonoClass *int32_class;
663         MonoClass *uint32_class;
664         MonoClass *int_class;
665         MonoClass *uint_class;
666         MonoClass *int64_class;
667         MonoClass *uint64_class;
668         MonoClass *single_class;
669         MonoClass *double_class;
670         MonoClass *char_class;
671         MonoClass *string_class;
672         MonoClass *enum_class;
673         MonoClass *array_class;
674         MonoClass *delegate_class;
675         MonoClass *multicastdelegate_class;
676         MonoClass *asyncresult_class;
677         MonoClass *waithandle_class;
678         MonoClass *typehandle_class;
679         MonoClass *fieldhandle_class;
680         MonoClass *methodhandle_class;
681         MonoClass *systemtype_class;
682         MonoClass *monotype_class;
683         MonoClass *exception_class;
684         MonoClass *threadabortexception_class;
685         MonoClass *thread_class;
686         MonoClass *transparent_proxy_class;
687         MonoClass *real_proxy_class;
688         MonoClass *mono_method_message_class;
689         MonoClass *appdomain_class;
690         MonoClass *field_info_class;
691         MonoClass *method_info_class;
692         MonoClass *stringbuilder_class;
693         MonoClass *math_class;
694         MonoClass *stack_frame_class;
695         MonoClass *stack_trace_class;
696         MonoClass *marshal_class;
697         MonoClass *iserializeable_class;
698         MonoClass *serializationinfo_class;
699         MonoClass *streamingcontext_class;
700         MonoClass *typed_reference_class;
701         MonoClass *argumenthandle_class;
702         MonoClass *marshalbyrefobject_class;
703         MonoClass *monitor_class;
704         MonoClass *iremotingtypeinfo_class;
705         MonoClass *runtimesecurityframe_class;
706         MonoClass *executioncontext_class;
707         MonoClass *internals_visible_class;
708         MonoClass *generic_ilist_class;
709         MonoClass *generic_nullable_class;
710         MonoClass *variant_class;
711         MonoClass *com_object_class;
712         MonoClass *com_interop_proxy_class;
713         MonoClass *iunknown_class;
714         MonoClass *idispatch_class;
715         MonoClass *safehandle_class;
716         MonoClass *handleref_class;
717         MonoClass *attribute_class;
718         MonoClass *customattribute_data_class;
719 } MonoDefaults;
720
721 extern MonoDefaults mono_defaults MONO_INTERNAL;
722
723 void
724 mono_loader_init           (void) MONO_INTERNAL;
725
726 void
727 mono_loader_cleanup        (void) MONO_INTERNAL;
728
729 void
730 mono_loader_lock           (void) MONO_INTERNAL;
731
732 void
733 mono_loader_unlock         (void) MONO_INTERNAL;
734
735 void
736 mono_loader_set_error_assembly_load (const char *assembly_name, gboolean ref_only) MONO_INTERNAL;
737
738 void
739 mono_loader_set_error_type_load (const char *class_name, const char *assembly_name) MONO_INTERNAL;
740
741 void
742 mono_loader_set_error_method_load (const char *class_name, const char *member_name) MONO_INTERNAL;
743
744 void
745 mono_loader_set_error_field_load (MonoClass *klass, const char *member_name) MONO_INTERNAL;
746
747 MonoException *
748 mono_loader_error_prepare_exception (MonoLoaderError *error) MONO_INTERNAL;
749
750 MonoLoaderError *
751 mono_loader_get_last_error (void) MONO_INTERNAL;
752
753 void
754 mono_loader_clear_error    (void) MONO_INTERNAL;
755
756 void
757 mono_reflection_init       (void) MONO_INTERNAL;
758
759 void
760 mono_icall_init            (void) MONO_INTERNAL;
761
762 void
763 mono_icall_cleanup         (void) MONO_INTERNAL;
764
765 gpointer
766 mono_method_get_wrapper_data (MonoMethod *method, guint32 id) MONO_INTERNAL;
767
768 void
769 mono_install_stack_walk (MonoStackWalkImpl func) MONO_INTERNAL;
770
771 gboolean
772 mono_metadata_has_generic_params (MonoImage *image, guint32 token) MONO_INTERNAL;
773
774 MonoGenericContainer *
775 mono_metadata_load_generic_params (MonoImage *image, guint32 token,
776                                    MonoGenericContainer *parent_container);
777
778 void
779 mono_metadata_load_generic_param_constraints (MonoImage *image, guint32 token,
780                                               MonoGenericContainer *container);
781
782 MonoMethodSignature*
783 mono_create_icall_signature (const char *sigstr) MONO_INTERNAL;
784
785 MonoJitICallInfo *
786 mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save) MONO_INTERNAL;
787
788 void
789 mono_register_jit_icall_wrapper (MonoJitICallInfo *info, gconstpointer wrapper) MONO_INTERNAL;
790
791 MonoJitICallInfo *
792 mono_find_jit_icall_by_name (const char *name) MONO_INTERNAL;
793
794 MonoJitICallInfo *
795 mono_find_jit_icall_by_addr (gconstpointer addr) MONO_INTERNAL;
796
797 gboolean
798 mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data) MONO_INTERNAL;
799
800 MonoException*
801 mono_class_get_exception_for_failure (MonoClass *klass) MONO_INTERNAL;
802
803 char*
804 mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format) MONO_INTERNAL;
805
806 char*
807 mono_type_get_full_name (MonoClass *class) MONO_INTERNAL;
808
809 MonoArrayType *mono_dup_array_type (MonoArrayType *a) MONO_INTERNAL;
810 MonoMethodSignature *mono_metadata_signature_deep_dup (MonoMethodSignature *sig) MONO_INTERNAL;
811
812 void
813 mono_image_init_name_cache (MonoImage *image);
814
815 gboolean mono_class_is_nullable (MonoClass *klass) MONO_INTERNAL;
816 MonoClass *mono_class_get_nullable_param (MonoClass *klass) MONO_INTERNAL;
817
818 /* object debugging functions, for use inside gdb */
819 void mono_object_describe        (MonoObject *obj);
820 void mono_object_describe_fields (MonoObject *obj);
821 void mono_value_describe_fields  (MonoClass* klass, const char* addr);
822 void mono_class_describe_statics (MonoClass* klass);
823
824 /*Enum validation related functions*/
825 gboolean
826 mono_type_is_valid_enum_basetype (MonoType * type);
827
828 gboolean
829 mono_class_is_valid_enum (MonoClass *klass);
830
831 #endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */
832