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