New test.
[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
279         guint8     exception_type;      /* MONO_EXCEPTION_* */
280         void*      exception_data;      /* Additional information about the exception */
281         guint32    declsec_flags;       /* declarative security attributes flags */
282
283         MonoClass  *parent;
284         MonoClass  *nested_in;
285         GList      *nested_classes;
286
287         guint32    type_token;
288         const char *name;
289         const char *name_space;
290         
291         /* for fast subtype checks */
292         MonoClass **supertypes;
293         guint16     idepth;
294
295         guint16     interface_count;
296         guint16     interface_id;        /* unique inderface id (for interfaces) */
297         guint16     max_interface_id;
298         gint       *interface_offsets;   
299         MonoClass **interfaces;
300
301         /*
302          * Computed object instance size, total.
303          */
304         int        instance_size;
305         int        vtable_size; /* number of slots */
306         union {
307                 int class_size; /* size of area for static fields */
308                 int element_size; /* for array types */
309         } sizes;
310
311         /*
312          * From the TypeDef table
313          */
314         guint32    flags;
315         struct {
316                 guint32 first, count;
317         } field, method, property, event;
318
319         /* loaded on demand */
320         MonoMarshalType *marshal_info;
321
322         /*
323          * Field information: Type and location from object base
324          */
325         MonoClassField *fields;
326
327         /* Initialized by a call to mono_class_setup_properties () */
328         MonoProperty *properties;
329
330         /* Initialized by a call to mono_class_setup_events () */
331         MonoEvent *events;
332
333         MonoMethod **methods;
334
335         /* used as the type of the this argument and when passing the arg by value */
336         MonoType this_arg;
337         MonoType byval_arg;
338
339         MonoGenericClass *generic_class;
340         MonoGenericContainer *generic_container;
341
342         void *reflection_info;
343
344         void *gc_descr;
345
346         MonoClassRuntimeInfo *runtime_info;
347
348         /* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
349         MonoMethod **vtable;    
350 };
351
352 /* the interface_offsets array is stored in memory before this struct */
353 struct MonoVTable {
354         MonoClass  *klass;
355          /*
356          * According to comments in gc_gcj.h, this should be the second word in
357          * the vtable.
358          */
359         void *gc_descr;         
360         MonoDomain *domain;  /* each object/vtable belongs to exactly one domain */
361         gpointer    data; /* to store static class data */
362         gpointer    type; /* System.Type type for klass */
363         guint16     max_interface_id;
364         guint8      rank;
365         guint remote          : 1; /* class is remotely activated */
366         guint initialized     : 1; /* cctor has been run */
367         guint init_failed     : 1; /* cctor execution failed */
368         /* do not add any fields after vtable, the structure is dynamically extended */
369         gpointer    vtable [MONO_ZERO_LEN_ARRAY];       
370 };
371
372 /*
373  * Generic instantiation data type encoding.
374  */
375
376 /*
377  * A particular generic instantiation:
378  *
379  * All instantiations are cached and we don't distinguish between class and method
380  * instantiations here.
381  */
382 struct _MonoGenericInst {
383         guint id;                       /* unique ID for debugging */
384         guint type_argc    : 22;        /* number of type arguments */
385         guint is_open      :  1;        /* if this is an open type */
386         guint is_reference :  1;        /* if this is a reference type */
387         MonoType **type_argv;
388 };
389
390 /*
391  * A particular instantiation of a generic type.
392  */
393 struct _MonoGenericClass {
394         MonoGenericInst *inst;          /* the instantiation */
395         MonoClass *container_class;     /* the generic type definition */
396         MonoGenericContext *context;    /* current context */
397         guint is_dynamic  : 1;          /* We're a MonoDynamicGenericClass */
398         guint is_inflated : 1;          /* We're a MonoInflatedGenericClass */
399 };
400
401 /*
402  * Performance optimization:
403  * We don't create the `MonoClass' for a `MonoGenericClass' until we really
404  * need it.
405  */
406 struct _MonoInflatedGenericClass {
407         MonoGenericClass generic_class;
408         guint is_initialized   : 1;
409         MonoClass *klass;
410 };
411
412 /*
413  * This is used when instantiating a generic type definition which is
414  * a TypeBuilder.
415  */
416 struct _MonoDynamicGenericClass {
417         MonoInflatedGenericClass generic_class;
418         int count_methods;
419         MonoMethod **methods;
420         int count_ctors;
421         MonoMethod **ctors;
422         int count_fields;
423         MonoClassField *fields;
424         int count_properties;
425         MonoProperty *properties;
426         int count_events;
427         MonoEvent *events;
428         guint initialized;
429 };
430
431 /*
432  * A particular instantiation of a generic method.
433  */
434 struct _MonoGenericMethod {
435         MonoGenericInst *inst;                  /* the instantiation */
436         MonoGenericClass *generic_class;        /* if we're in a generic type */
437         MonoGenericContainer *container;        /* type parameters */
438         gpointer reflection_info;
439 };
440
441 /*
442  * The generic context.
443  */
444 struct _MonoGenericContext {
445         /*
446          * The container which has been instantiated.
447          *
448          * If we're in a generic method, the generic method definition's container.
449          * Otherwise the generic type's container.
450          */
451         MonoGenericContainer *container;
452         /* The current generic class */
453         MonoGenericClass *gclass;
454         /* The current generic method */
455         MonoGenericMethod *gmethod;
456 };
457
458 /*
459  * The generic container.
460  *
461  * Stores the type parameters of a generic type definition or a generic method definition.
462  */
463 struct _MonoGenericContainer {
464         MonoGenericContext context;
465         /* If we're a generic method definition in a generic type definition,
466            the generic container of the containing class. */
467         MonoGenericContainer *parent;
468         /* If we're a generic method definition, caches all their instantiations. */
469         GHashTable *method_hash;
470         /* If we're a generic type definition, its `MonoClass'. */
471         MonoClass *klass;
472         int type_argc    : 6;
473         /* If true, we're a generic method, otherwise a generic type definition. */
474         /* Invariant: parent != NULL => is_method */
475         int is_method    : 1;
476         /* Our type parameters. */
477         MonoGenericParam *type_params;
478 };
479
480 /*
481  * A type parameter.
482  */
483 struct _MonoGenericParam {
484         MonoGenericContainer *owner;    /* Type or method this parameter was defined in. */
485         MonoClass *pklass;              /* The corresponding `MonoClass'. */
486         MonoMethod *method;             /* If we're a method type parameter, the method. */
487         const char *name;
488         guint16 flags;
489         guint16 num;
490         MonoClass** constraints; /* NULL means end of list */
491 };
492
493 /*
494  * Class information which might be cached by the runtime in the AOT file for
495  * example. Caching this allows us to avoid computing a generic vtable
496  * (class->vtable) in most cases, saving time and avoiding creation of lots of
497  * MonoMethod structures.
498  */
499 typedef struct MonoCachedClassInfo {
500         guint32 vtable_size;
501         guint has_finalize : 1;
502         guint ghcimpl : 1;
503         guint has_cctor : 1;
504         guint has_nested_classes : 1;
505         guint blittable : 1;
506         guint has_references : 1;
507         guint has_static_refs : 1;
508         guint no_special_static_fields : 1;
509         guint32 cctor_token;
510         MonoImage *finalize_image;
511         guint32 finalize_token;
512         guint32 instance_size;
513         guint32 class_size;
514         guint32 packing_size;
515         guint32 min_align;
516 } MonoCachedClassInfo;
517
518 typedef struct {
519         const char *name;
520         gconstpointer func;
521         gconstpointer wrapper;
522         gconstpointer trampoline;
523         MonoMethodSignature *sig;
524 } MonoJitICallInfo;
525
526 /*
527  * Information about a type load error encountered by the loader.
528  */
529 typedef enum {
530         MONO_LOADER_ERROR_TYPE,
531         MONO_LOADER_ERROR_METHOD,
532         MONO_LOADER_ERROR_FIELD,
533         MONO_LOADER_ERROR_ASSEMBLY
534 } MonoLoaderErrorKind;
535
536 typedef struct {
537         MonoLoaderErrorKind kind;
538         char *class_name; /* If kind == TYPE */
539         char *assembly_name; /* If kind == TYPE or ASSEMBLY */
540         MonoClass *klass; /* If kind != TYPE */
541         const char *member_name; /* If kind != TYPE */
542         gboolean ref_only; /* If kind == ASSEMBLY */
543 } MonoLoaderError;
544
545 #define mono_class_has_parent(klass,parent) (((klass)->idepth >= (parent)->idepth) && ((klass)->supertypes [(parent)->idepth - 1] == (parent)))
546
547 typedef struct {
548         gulong new_object_count;
549         gulong initialized_class_count;
550         gulong generic_vtable_count;
551         gulong used_class_count;
552         gulong method_count;
553         gulong class_vtable_size;
554         gulong class_static_data_size;
555         gulong generic_instance_count;
556         gulong generic_class_count;
557         gulong inflated_method_count;
558         gulong inflated_method_count_2;
559         gulong inflated_type_count;
560         gulong generics_metadata_size;
561         gboolean enabled;
562 } MonoStats;
563
564 extern MonoStats mono_stats MONO_INTERNAL;
565
566 typedef gpointer (*MonoTrampoline)       (MonoMethod *method);
567 typedef gpointer (*MonoRemotingTrampoline)       (MonoMethod *method, MonoRemotingTarget target);
568 typedef gpointer (*MonoDelegateTrampoline)       (MonoMethod *method, gpointer addr);
569
570 typedef gpointer (*MonoLookupDynamicToken) (MonoImage *image, guint32 token, MonoClass **handle_class);
571
572 typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
573
574 typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
575
576 void
577 mono_classes_init (void) MONO_INTERNAL;
578
579 void
580 mono_classes_cleanup (void) MONO_INTERNAL;
581
582 void
583 mono_class_layout_fields   (MonoClass *klass) MONO_INTERNAL;
584
585 void
586 mono_class_setup_interface_offsets (MonoClass *klass) MONO_INTERNAL;
587
588 void
589 mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int onum) MONO_INTERNAL;
590
591 void
592 mono_class_setup_vtable (MonoClass *klass) MONO_INTERNAL;
593
594 void
595 mono_class_setup_methods (MonoClass *klass) MONO_INTERNAL;
596
597 void
598 mono_class_setup_mono_type (MonoClass *klass) MONO_INTERNAL;
599
600 void
601 mono_class_setup_parent    (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
602
603 void
604 mono_class_setup_supertypes (MonoClass *klass) MONO_INTERNAL;
605
606 GPtrArray*
607 mono_class_get_implemented_interfaces (MonoClass *klass) MONO_INTERNAL;
608
609 gboolean
610 mono_class_is_open_constructed_type (MonoType *t) MONO_INTERNAL;
611
612 gboolean
613 mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides,
614                                MonoGenericContext *generic_context) MONO_INTERNAL;
615
616 MonoMethod*
617 mono_class_get_cctor (MonoClass *klass) MONO_INTERNAL;
618
619 MonoMethod*
620 mono_class_get_finalizer (MonoClass *klass) MONO_INTERNAL;
621
622 gboolean
623 mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller) MONO_INTERNAL;
624
625 gboolean
626 mono_class_has_special_static_fields (MonoClass *klass) MONO_INTERNAL;
627
628 void
629 mono_install_trampoline (MonoTrampoline func) MONO_INTERNAL;
630
631 void
632 mono_install_remoting_trampoline (MonoRemotingTrampoline func) MONO_INTERNAL;
633
634 void
635 mono_install_delegate_trampoline (MonoDelegateTrampoline func) MONO_INTERNAL;
636
637 gpointer
638 mono_lookup_dynamic_token (MonoImage *image, guint32 token) MONO_INTERNAL;
639
640 gpointer
641 mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, MonoClass **handle_class) MONO_INTERNAL;
642
643 void
644 mono_install_lookup_dynamic_token (MonoLookupDynamicToken func) MONO_INTERNAL;
645
646 void
647 mono_install_get_cached_class_info (MonoGetCachedClassInfo func) MONO_INTERNAL;
648
649 void
650 mono_install_get_class_from_name (MonoGetClassFromName func) MONO_INTERNAL;
651
652 MonoInflatedGenericClass*
653 mono_get_inflated_generic_class (MonoGenericClass *gclass) MONO_INTERNAL;
654
655 MonoMethod*
656 mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context);
657
658
659 typedef struct {
660         MonoImage *corlib;
661         MonoClass *object_class;
662         MonoClass *byte_class;
663         MonoClass *void_class;
664         MonoClass *boolean_class;
665         MonoClass *sbyte_class;
666         MonoClass *int16_class;
667         MonoClass *uint16_class;
668         MonoClass *int32_class;
669         MonoClass *uint32_class;
670         MonoClass *int_class;
671         MonoClass *uint_class;
672         MonoClass *int64_class;
673         MonoClass *uint64_class;
674         MonoClass *single_class;
675         MonoClass *double_class;
676         MonoClass *char_class;
677         MonoClass *string_class;
678         MonoClass *enum_class;
679         MonoClass *array_class;
680         MonoClass *delegate_class;
681         MonoClass *multicastdelegate_class;
682         MonoClass *asyncresult_class;
683         MonoClass *waithandle_class;
684         MonoClass *typehandle_class;
685         MonoClass *fieldhandle_class;
686         MonoClass *methodhandle_class;
687         MonoClass *systemtype_class;
688         MonoClass *monotype_class;
689         MonoClass *exception_class;
690         MonoClass *threadabortexception_class;
691         MonoClass *thread_class;
692         MonoClass *transparent_proxy_class;
693         MonoClass *real_proxy_class;
694         MonoClass *mono_method_message_class;
695         MonoClass *appdomain_class;
696         MonoClass *field_info_class;
697         MonoClass *method_info_class;
698         MonoClass *stringbuilder_class;
699         MonoClass *math_class;
700         MonoClass *stack_frame_class;
701         MonoClass *stack_trace_class;
702         MonoClass *marshal_class;
703         MonoClass *iserializeable_class;
704         MonoClass *serializationinfo_class;
705         MonoClass *streamingcontext_class;
706         MonoClass *typed_reference_class;
707         MonoClass *argumenthandle_class;
708         MonoClass *marshalbyrefobject_class;
709         MonoClass *monitor_class;
710         MonoClass *iremotingtypeinfo_class;
711         MonoClass *runtimesecurityframe_class;
712         MonoClass *executioncontext_class;
713         MonoClass *internals_visible_class;
714         MonoClass *generic_ilist_class;
715         MonoClass *generic_nullable_class;
716         MonoClass *variant_class;
717         MonoClass *com_object_class;
718         MonoClass *com_interop_proxy_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_icall_init            (void) MONO_INTERNAL;
758
759 void
760 mono_icall_cleanup         (void) MONO_INTERNAL;
761
762 gpointer
763 mono_method_get_wrapper_data (MonoMethod *method, guint32 id) MONO_INTERNAL;
764
765 void
766 mono_install_stack_walk (MonoStackWalkImpl func) MONO_INTERNAL;
767
768 gboolean
769 mono_metadata_has_generic_params (MonoImage *image, guint32 token) MONO_INTERNAL;
770
771 MonoGenericContainer *
772 mono_metadata_load_generic_params (MonoImage *image, guint32 token,
773                                    MonoGenericContainer *parent_container);
774
775 void
776 mono_metadata_load_generic_param_constraints (MonoImage *image, guint32 token,
777                                               MonoGenericContainer *container);
778
779 MonoMethodSignature*
780 mono_create_icall_signature (const char *sigstr) MONO_INTERNAL;
781
782 MonoJitICallInfo *
783 mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save) MONO_INTERNAL;
784
785 void
786 mono_register_jit_icall_wrapper (MonoJitICallInfo *info, gconstpointer wrapper) MONO_INTERNAL;
787
788 MonoJitICallInfo *
789 mono_find_jit_icall_by_name (const char *name) MONO_INTERNAL;
790
791 MonoJitICallInfo *
792 mono_find_jit_icall_by_addr (gconstpointer addr) MONO_INTERNAL;
793
794 MonoGenericInst *
795 mono_get_shared_generic_inst (MonoGenericContainer *container) MONO_INTERNAL;
796
797 MonoGenericClass *
798 mono_get_shared_generic_class (MonoGenericContainer *container, gboolean is_dynamic) MONO_INTERNAL;
799
800 MonoGenericMethod *
801 mono_get_shared_generic_method (MonoGenericContainer *container) MONO_INTERNAL;
802
803 gboolean
804 mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data) MONO_INTERNAL;
805
806 MonoException*
807 mono_class_get_exception_for_failure (MonoClass *klass) MONO_INTERNAL;
808
809 char*
810 mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format) MONO_INTERNAL;
811
812 char*
813 mono_type_get_full_name (MonoClass *class) MONO_INTERNAL;
814
815 MonoArrayType *mono_dup_array_type (MonoArrayType *a) MONO_INTERNAL;
816 MonoMethodSignature *mono_metadata_signature_deep_dup (MonoMethodSignature *sig) MONO_INTERNAL;
817
818 void
819 mono_image_init_name_cache (MonoImage *image);
820
821 gboolean mono_class_is_nullable (MonoClass *klass) MONO_INTERNAL;
822 MonoClass *mono_class_get_nullable_param (MonoClass *klass) MONO_INTERNAL;
823
824 /* object debugging functions, for use inside gdb */
825 void mono_object_describe        (MonoObject *obj);
826 void mono_object_describe_fields (MonoObject *obj);
827 void mono_value_describe_fields  (MonoClass* klass, const char* addr);
828 void mono_class_describe_statics (MonoClass* klass);
829
830 #endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */
831