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