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