1 #ifndef __MONO_METADATA_CLASS_INTERBALS_H__
2 #define __MONO_METADATA_CLASS_INTERBALS_H__
4 #include <mono/metadata/class.h>
5 #include <mono/metadata/object.h>
6 #include <mono/metadata/mempool.h>
7 #include <mono/io-layer/io-layer.h>
8 #include "mono/utils/mono-compiler.h"
10 #define MONO_CLASS_IS_ARRAY(c) ((c)->rank)
12 #define MONO_CLASS_HAS_STATIC_METADATA(klass) ((klass)->type_token && !(klass)->image->dynamic && !(klass)->generic_class)
14 #define MONO_DEFAULT_SUPERTABLE_SIZE 6
16 extern gboolean mono_print_vtable;
18 extern gboolean mono_setup_vtable_in_class_init;
20 typedef void (*MonoStackWalkImpl) (MonoStackWalk func, gboolean do_il_offset, gpointer user_data);
22 typedef struct _MonoMethodNormal MonoMethodNormal;
23 typedef struct _MonoMethodWrapper MonoMethodWrapper;
24 typedef struct _MonoMethodInflated MonoMethodInflated;
25 typedef struct _MonoMethodPInvoke MonoMethodPInvoke;
27 /* Properties that applies to a group of structs should better use a higher number
28 * to avoid colision with type specific properties.
30 * This prop applies to class, method, property, event, assembly and image.
32 #define MONO_PROP_DYNAMIC_CATTR 0x1000
35 #define WRAPPER(e,n) MONO_WRAPPER_ ## e,
36 #include "wrapper-types.h"
42 MONO_TYPE_NAME_FORMAT_IL,
43 MONO_TYPE_NAME_FORMAT_REFLECTION,
44 MONO_TYPE_NAME_FORMAT_FULL_NAME,
45 MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
49 MONO_REMOTING_TARGET_UNKNOWN,
50 MONO_REMOTING_TARGET_APPDOMAIN,
51 MONO_REMOTING_TARGET_COMINTEROP
54 #define MONO_METHOD_PROP_GENERIC_CONTAINER 0
57 guint16 flags; /* method flags */
58 guint16 iflags; /* method implementation flags */
61 MonoMethodSignature *signature;
62 /* name is useful mostly for debugging */
64 /* this is used by the inlining algorithm */
65 unsigned int inline_info:1;
66 unsigned int inline_failure:1;
67 unsigned int wrapper_type:5;
68 unsigned int string_ctor:1;
69 unsigned int save_lmf:1;
70 unsigned int dynamic:1; /* created & destroyed during runtime */
71 unsigned int is_generic:1; /* whenever this is a generic method definition */
72 unsigned int is_inflated:1; /* whether we're a MonoMethodInflated */
73 unsigned int skip_visibility:1; /* whenever to skip JIT visibility checks */
74 unsigned int verification_success:1; /* whether this method has been verified successfully.*/
78 * If is_generic is TRUE, the generic_container is stored in image->property_hash,
79 * using the key MONO_METHOD_PROP_GENERIC_CONTAINER.
83 struct _MonoMethodNormal {
85 MonoMethodHeader *header;
88 struct _MonoMethodWrapper {
89 MonoMethodNormal method;
93 struct _MonoMethodPInvoke {
96 /* add marshal info */
97 guint16 piflags; /* pinvoke flags */
98 guint16 implmap_idx; /* index into IMPLMAP */
102 * Stores the default value / RVA of fields.
103 * This information is rarely needed, so it is stored separately from MonoClassField.
105 typedef struct MonoFieldDefaultValue {
107 * If the field is constant, pointer to the metadata constant
109 * If the field has an RVA flag, pointer to the data.
114 /* If the field is constant, the type of the constant. */
115 MonoTypeEnum def_type;
116 } MonoFieldDefaultValue;
119 * MonoClassField is just a runtime representation of the metadata for
120 * field, it doesn't contain the data directly. Static fields are
121 * stored in MonoVTable->data. Instance fields are allocated in the
122 * objects after the object header.
124 struct _MonoClassField {
125 /* Type of the field */
130 /* Type where the field was defined */
134 * Offset where this field is stored; if it is an instance
135 * field, it's the offset from the start of the object, if
136 * it's static, it's from the start of the memory chunk
137 * allocated for statics for the class.
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 (mono_field_get_name (field), "_Deleted") == 0))
147 MonoClassField *field;
149 MonoMarshalSpec *mspec;
155 MonoMethod *ptr_to_str;
156 MonoMethod *str_to_ptr;
157 MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
160 struct _MonoProperty {
178 /* type of exception being "on hold" for later processing (see exception_type) */
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 MONO_EXCEPTION_FILE_NOT_FOUND = 8,
189 MONO_EXCEPTION_METHOD_ACCESS = 9,
190 MONO_EXCEPTION_FIELD_ACCESS = 10,
191 MONO_EXCEPTION_GENERIC_SHARING_FAILED = 11,
192 MONO_EXCEPTION_BAD_IMAGE = 12,
193 MONO_EXCEPTION_OBJECT_SUPPLIED = 13 /*The exception object is already created.*/
194 /* add other exception type */
197 /* This struct collects the info needed for the runtime use of a class,
198 * like the vtables for a domain, the GC descriptor, etc.
202 /* domain_vtables is indexed by the domain id and the size is max_domain + 1 */
203 MonoVTable *domain_vtables [MONO_ZERO_LEN_ARRAY];
204 } MonoClassRuntimeInfo;
207 MONO_RGCTX_INFO_STATIC_DATA,
208 MONO_RGCTX_INFO_KLASS,
209 MONO_RGCTX_INFO_VTABLE,
210 MONO_RGCTX_INFO_TYPE,
211 MONO_RGCTX_INFO_REFLECTION_TYPE,
212 MONO_RGCTX_INFO_METHOD,
213 MONO_RGCTX_INFO_GENERIC_METHOD_CODE,
214 MONO_RGCTX_INFO_CLASS_FIELD,
215 MONO_RGCTX_INFO_METHOD_RGCTX,
216 MONO_RGCTX_INFO_METHOD_CONTEXT
219 typedef struct _MonoRuntimeGenericContextOtherInfoTemplate {
222 struct _MonoRuntimeGenericContextOtherInfoTemplate *next;
223 } MonoRuntimeGenericContextOtherInfoTemplate;
226 MonoClass *next_subclass;
227 MonoRuntimeGenericContextOtherInfoTemplate *other_infos;
228 GSList *method_templates;
229 } MonoRuntimeGenericContextTemplate;
232 MonoVTable *class_vtable; /* must be the first element */
233 MonoGenericInst *method_inst;
234 gpointer infos [MONO_ZERO_LEN_ARRAY];
235 } MonoMethodRuntimeGenericContext;
237 #define MONO_RGCTX_SLOT_MAKE_RGCTX(i) (i)
238 #define MONO_RGCTX_SLOT_MAKE_MRGCTX(i) ((i) | 0x80000000)
239 #define MONO_RGCTX_SLOT_INDEX(s) ((s) & 0x7fffffff)
240 #define MONO_RGCTX_SLOT_IS_MRGCTX(s) (((s) & 0x80000000) ? TRUE : FALSE)
243 #define MONO_CLASS_PROP_EXCEPTION_DATA 0
246 /* element class for arrays and enum */
247 MonoClass *element_class;
248 /* used for subtype checks */
249 MonoClass *cast_class;
251 /* for fast subtype checks */
252 MonoClass **supertypes;
255 /* array dimension */
258 int instance_size; /* object instance size */
261 /* We use init_pending to detect cyclic calls to mono_class_init */
262 guint init_pending : 1;
264 /* A class contains static and non static data. Static data can be
265 * of the same type as the class itselfs, but it does not influence
266 * the instance size of the class. To avoid cyclic calls to
267 * mono_class_init (from mono_class_instance_size ()) we first
268 * initialise all non static fields. After that we set size_inited
269 * to 1, because we know the instance size now. After that we
270 * initialise all static fields.
272 guint size_inited : 1;
273 guint valuetype : 1; /* derives from System.ValueType */
274 guint enumtype : 1; /* derives from System.Enum */
275 guint blittable : 1; /* class is blittable */
276 guint unicode : 1; /* class uses unicode char when marshalled */
277 guint wastypebuilder : 1; /* class was created at runtime from a TypeBuilder */
281 guint packing_size : 4;
282 /* still 4 bits free */
284 guint ghcimpl : 1; /* class has its own GetHashCode impl */
285 guint has_finalize : 1; /* class has its own Finalize impl */
286 guint marshalbyref : 1; /* class is a MarshalByRefObject */
287 guint contextbound : 1; /* class is a ContextBoundObject */
288 guint delegate : 1; /* class is a Delegate */
289 guint gc_descr_inited : 1; /* gc_descr is initialized */
290 guint has_cctor : 1; /* class has a cctor */
291 guint has_references : 1; /* it has GC-tracked references in the instance */
293 guint has_static_refs : 1; /* it has static fields that are GC-tracked */
294 guint no_special_static_fields : 1; /* has no thread/context static fields */
295 /* directly or indirectly derives from ComImport attributed class.
296 * this means we need to create a proxy for instances of this class
297 * for COM Interop. set this flag on loading so all we need is a quick check
298 * during object creation rather than having to traverse supertypes
300 guint is_com_object : 1;
301 guint nested_classes_inited : 1; /* Whenever nested_class is initialized */
302 guint simd_type : 1; /* class is a simd intrinsic type */
304 guint8 exception_type; /* MONO_EXCEPTION_* */
306 /* Additional information about the exception */
307 /* Stored as property MONO_CLASS_PROP_EXCEPTION_DATA */
308 //void *exception_data;
311 MonoClass *nested_in;
312 GList *nested_classes;
316 const char *name_space;
318 /* The underlying type of the enum */
319 MonoType *enum_basetype;
321 guint32 declsec_flags; /* declarative security attributes flags */
323 int vtable_size; /* number of slots */
325 guint16 interface_count;
326 guint16 interface_id; /* unique inderface id (for interfaces) */
327 guint16 max_interface_id;
329 guint16 interface_offsets_count;
330 MonoClass **interfaces_packed;
331 guint16 *interface_offsets_packed;
332 guint8 *interface_bitmap;
334 MonoClass **interfaces;
337 int class_size; /* size of area for static fields */
338 int element_size; /* for array types */
339 int generic_param_token; /* for generic param types, both var and mvar */
343 * From the TypeDef table
347 guint32 first, count;
348 } field, method, property, event;
350 /* loaded on demand */
351 MonoMarshalType *marshal_info;
354 * Field information: Type and location from object base
356 MonoClassField *fields;
358 /* Initialized by a call to mono_class_setup_properties () */
359 MonoProperty *properties;
361 /* Initialized by a call to mono_class_setup_events () */
364 MonoMethod **methods;
366 /* used as the type of the this argument and when passing the arg by value */
370 MonoGenericClass *generic_class;
371 MonoGenericContainer *generic_container;
373 void *reflection_info;
377 MonoClassRuntimeInfo *runtime_info;
379 /* next element in the class_cache hash list (in MonoImage) */
380 MonoClass *next_class_cache;
382 /* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
385 /* Default values/RVA for fields */
386 /* Accessed using mono_class_get_field_default_value () / mono_field_get_data () */
387 MonoFieldDefaultValue *field_def_values;
390 #define MONO_CLASS_IMPLEMENTS_INTERFACE(k,uiid) (((uiid) <= (k)->max_interface_id) && ((k)->interface_bitmap [(uiid) >> 3] & (1 << ((uiid)&7))))
391 int mono_class_interface_offset (MonoClass *klass, MonoClass *itf);
393 typedef gpointer MonoRuntimeGenericContext;
395 /* the interface_offsets array is stored in memory before this struct */
399 * According to comments in gc_gcj.h, this should be the second word in
403 MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
404 gpointer data; /* to store static class data */
405 gpointer type; /* System.Type type for klass */
406 guint8 *interface_bitmap;
407 guint16 max_interface_id;
409 guint remote : 1; /* class is remotely activated */
410 guint initialized : 1; /* cctor has been run */
411 guint init_failed : 1; /* cctor execution failed */
412 guint32 imt_collisions_bitmap;
413 MonoRuntimeGenericContext *runtime_generic_context;
414 /* do not add any fields after vtable, the structure is dynamically extended */
415 gpointer vtable [MONO_ZERO_LEN_ARRAY];
418 #define MONO_VTABLE_IMPLEMENTS_INTERFACE(vt,uiid) (((uiid) <= (vt)->max_interface_id) && ((vt)->interface_bitmap [(uiid) >> 3] & (1 << ((uiid)&7))))
421 * Generic instantiation data type encoding.
425 * A particular generic instantiation:
427 * All instantiations are cached and we don't distinguish between class and method
428 * instantiations here.
430 struct _MonoGenericInst {
431 guint id; /* unique ID for debugging */
432 guint type_argc : 22; /* number of type arguments */
433 guint is_open : 1; /* if this is an open type */
434 MonoType **type_argv;
438 * The generic context: an instantiation of a set of class and method generic parameters.
440 * NOTE: Never allocate this directly on the heap. It have to be either allocated on the stack,
441 * or embedded within other objects. Don't store pointers to this, because it may be on the stack.
442 * If you really have to, ensure you store a pointer to the embedding object along with it.
444 struct _MonoGenericContext {
445 /* The instantiation corresponding to the class generic parameters */
446 MonoGenericInst *class_inst;
447 /* The instantiation corresponding to the method generic parameters */
448 MonoGenericInst *method_inst;
452 * Inflated generic method.
454 struct _MonoMethodInflated {
457 MonoMethodNormal normal;
458 MonoMethodPInvoke pinvoke;
460 MonoMethod *declaring; /* the generic method definition. */
461 MonoGenericContext context; /* The current instantiation */
463 /* TODO we MUST get rid of this field, it's an ugly hack nobody is proud of. */
464 guint is_mb_open : 1; /* This is the fully open instantiation of a generic method_builder. Worse than is_tb_open, but it's temporary */
468 * A particular instantiation of a generic type.
470 struct _MonoGenericClass {
471 MonoClass *container_class; /* the generic type definition */
472 MonoGenericContext context; /* a context that contains the type instantiation doesn't contain any method instantiation */
473 guint is_dynamic : 1; /* We're a MonoDynamicGenericClass */
474 guint is_tb_open : 1; /* This is the fully open instantiation for a type_builder. Quite ugly, but it's temporary.*/
475 MonoClass *cached_class; /* if present, the MonoClass corresponding to the instantiation. */
479 * This is used when instantiating a generic type definition which is
482 struct _MonoDynamicGenericClass {
483 MonoGenericClass generic_class;
485 MonoMethod **methods;
489 MonoClassField *fields;
490 int count_properties;
491 MonoProperty *properties;
495 /* The non-inflated types of the fields */
496 MonoType **field_generic_types;
497 /* The managed objects representing the fields */
498 MonoObject **field_objects;
502 * The generic container.
504 * Stores the type parameters of a generic type definition or a generic method definition.
506 struct _MonoGenericContainer {
507 MonoGenericContext context;
508 /* If we're a generic method definition in a generic type definition,
509 the generic container of the containing class. */
510 MonoGenericContainer *parent;
511 /* the generic type definition or the generic method definition corresponding to this container */
517 /* If true, we're a generic method, otherwise a generic type definition. */
518 /* Invariant: parent != NULL => is_method */
520 /* Our type parameters. */
521 MonoGenericParam *type_params;
527 struct _MonoGenericParam {
528 MonoGenericContainer *owner; /* Type or method this parameter was defined in. */
529 MonoClass *pklass; /* The corresponding `MonoClass'. */
533 MonoClass** constraints; /* NULL means end of list */
534 /* If owner is NULL, this is the image whose mempool this struct was allocated from */
539 * Class information which might be cached by the runtime in the AOT file for
540 * example. Caching this allows us to avoid computing a generic vtable
541 * (class->vtable) in most cases, saving time and avoiding creation of lots of
542 * MonoMethod structures.
544 typedef struct MonoCachedClassInfo {
546 guint has_finalize : 1;
549 guint has_nested_classes : 1;
551 guint has_references : 1;
552 guint has_static_refs : 1;
553 guint no_special_static_fields : 1;
555 MonoImage *finalize_image;
556 guint32 finalize_token;
557 guint32 instance_size;
559 guint32 packing_size;
561 } MonoCachedClassInfo;
566 gconstpointer wrapper;
567 gconstpointer trampoline;
568 MonoMethodSignature *sig;
572 guint8 exception_type;
573 char *class_name; /* If kind == TYPE */
574 char *assembly_name; /* If kind == TYPE or ASSEMBLY */
575 MonoClass *klass; /* If kind != TYPE */
576 const char *member_name; /* If kind != TYPE */
577 gboolean ref_only; /* If kind == ASSEMBLY */
578 char *msg; /* If kind == BAD_IMAGE */
581 #define mono_class_has_parent(klass,parent) (((klass)->idepth >= (parent)->idepth) && ((klass)->supertypes [(parent)->idepth - 1] == (parent)))
584 gulong new_object_count;
585 gulong initialized_class_count;
586 gulong generic_vtable_count;
587 gulong used_class_count;
589 gulong class_vtable_size;
590 gulong class_static_data_size;
591 gulong generic_instance_count;
592 gulong generic_class_count;
593 gulong inflated_method_count;
594 gulong inflated_method_count_2;
595 gulong inflated_type_count;
596 gulong generics_metadata_size;
597 gulong dynamic_code_alloc_count;
598 gulong dynamic_code_bytes_count;
599 gulong dynamic_code_frees_count;
600 gulong delegate_creations;
601 gulong imt_tables_size;
602 gulong imt_number_of_tables;
603 gulong imt_number_of_methods;
604 gulong imt_used_slots;
605 gulong imt_slots_with_collisions;
606 gulong imt_max_collisions_in_slot;
607 gulong imt_method_count_when_max_collisions;
608 gulong imt_thunks_size;
609 gulong jit_info_table_insert_count;
610 gulong jit_info_table_remove_count;
611 gulong jit_info_table_lookup_count;
612 gulong hazardous_pointer_count;
613 gulong generics_sharable_methods;
614 gulong generics_unsharable_methods;
615 gulong generics_shared_methods;
616 gulong minor_gc_count;
617 gulong major_gc_count;
618 gulong minor_gc_time_usecs;
619 gulong major_gc_time_usecs;
624 * new structure to hold performace counters values that are exported
626 * Note: never remove fields from this structure and only add them to the end.
627 * Size of fields and type should not be changed as well.
634 guint32 jit_failures;
635 /* Exceptions category */
636 guint32 exceptions_thrown;
637 guint32 exceptions_filters;
638 guint32 exceptions_finallys;
639 guint32 exceptions_depth;
640 guint32 aspnet_requests_queued;
641 /* Memory category */
642 guint32 gc_collections0;
643 guint32 gc_collections1;
644 guint32 gc_collections2;
645 guint32 gc_promotions0;
646 guint32 gc_promotions1;
647 guint32 gc_promotion_finalizers;
652 guint32 gc_fin_survivors;
653 guint32 gc_num_handles;
654 guint32 gc_allocated;
657 guint32 gc_total_bytes;
658 guint32 gc_committed_bytes;
659 guint32 gc_reserved_bytes;
660 guint32 gc_num_pinned;
661 guint32 gc_sync_blocks;
662 /* Remoting category */
663 guint32 remoting_calls;
664 guint32 remoting_channels;
665 guint32 remoting_proxies;
666 guint32 remoting_classes;
667 guint32 remoting_objects;
668 guint32 remoting_contexts;
669 /* Loader category */
670 guint32 loader_classes;
671 guint32 loader_total_classes;
672 guint32 loader_appdomains;
673 guint32 loader_total_appdomains;
674 guint32 loader_assemblies;
675 guint32 loader_total_assemblies;
676 guint32 loader_failures;
677 guint32 loader_bytes;
678 guint32 loader_appdomains_uloaded;
679 /* Threads and Locks category */
680 guint32 thread_contentions;
681 guint32 thread_queue_len;
682 guint32 thread_queue_max;
683 guint32 thread_num_logical;
684 guint32 thread_num_physical;
685 guint32 thread_cur_recognized;
686 guint32 thread_num_recognized;
687 /* Interop category */
688 guint32 interop_num_ccw;
689 guint32 interop_num_stubs;
690 guint32 interop_num_marshals;
691 /* Security category */
692 guint32 security_num_checks;
693 guint32 security_num_link_checks;
694 guint32 security_time;
695 guint32 security_depth;
699 extern MonoPerfCounters *mono_perfcounters MONO_INTERNAL;
701 void mono_perfcounters_init (void);
704 * The definition of the first field in SafeHandle,
705 * Keep in sync with SafeHandle.cs, this is only used
706 * to access the `handle' parameter.
714 * Keep in sync with HandleRef.cs
722 MONO_GENERIC_SHARING_NONE,
723 MONO_GENERIC_SHARING_COLLECTIONS,
724 MONO_GENERIC_SHARING_CORLIB,
725 MONO_GENERIC_SHARING_ALL
729 * Flags for which contexts were used in inflating a generic.
732 MONO_GENERIC_CONTEXT_USED_CLASS = 1,
733 MONO_GENERIC_CONTEXT_USED_METHOD = 2
736 #define MONO_GENERIC_CONTEXT_USED_BOTH (MONO_GENERIC_CONTEXT_USED_CLASS | MONO_GENERIC_CONTEXT_USED_METHOD)
738 extern MonoStats mono_stats MONO_INTERNAL;
740 typedef gpointer (*MonoTrampoline) (MonoMethod *method);
741 typedef gpointer (*MonoJumpTrampoline) (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper);
742 typedef gpointer (*MonoRemotingTrampoline) (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target);
743 typedef gpointer (*MonoDelegateTrampoline) (MonoClass *klass);
745 typedef gpointer (*MonoLookupDynamicToken) (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context);
747 typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
749 typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
752 mono_classes_init (void) MONO_INTERNAL;
755 mono_classes_cleanup (void) MONO_INTERNAL;
758 mono_class_layout_fields (MonoClass *klass) MONO_INTERNAL;
761 mono_class_setup_interface_offsets (MonoClass *klass) MONO_INTERNAL;
764 mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int onum) MONO_INTERNAL;
767 mono_class_setup_vtable (MonoClass *klass) MONO_INTERNAL;
770 mono_class_setup_methods (MonoClass *klass) MONO_INTERNAL;
773 mono_class_setup_mono_type (MonoClass *klass) MONO_INTERNAL;
776 mono_class_setup_parent (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
779 mono_class_setup_supertypes (MonoClass *klass) MONO_INTERNAL;
782 mono_class_get_method_by_index (MonoClass *class, int index) MONO_INTERNAL;
785 mono_class_get_inflated_method (MonoClass *class, MonoMethod *method) MONO_INTERNAL;
788 mono_class_get_vtable_entry (MonoClass *class, int offset) MONO_INTERNAL;
791 mono_class_get_implemented_interfaces (MonoClass *klass) MONO_INTERNAL;
794 mono_class_is_open_constructed_type (MonoType *t) MONO_INTERNAL;
797 mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides,
798 MonoGenericContext *generic_context) MONO_INTERNAL;
801 mono_class_get_cctor (MonoClass *klass) MONO_INTERNAL;
804 mono_class_get_finalizer (MonoClass *klass) MONO_INTERNAL;
807 mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller) MONO_INTERNAL;
810 mono_class_field_is_special_static (MonoClassField *field) MONO_INTERNAL;
813 mono_class_has_special_static_fields (MonoClass *klass) MONO_INTERNAL;
816 mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_type) MONO_INTERNAL;
819 mono_install_trampoline (MonoTrampoline func) MONO_INTERNAL;
822 mono_install_jump_trampoline (MonoJumpTrampoline func) MONO_INTERNAL;
825 mono_install_remoting_trampoline (MonoRemotingTrampoline func) MONO_INTERNAL;
828 mono_install_delegate_trampoline (MonoDelegateTrampoline func) MONO_INTERNAL;
831 mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context) MONO_INTERNAL;
834 mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, gboolean check_token, MonoClass **handle_class, MonoGenericContext *context) MONO_INTERNAL;
837 mono_install_lookup_dynamic_token (MonoLookupDynamicToken func) MONO_INTERNAL;
840 mono_runtime_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper) MONO_INTERNAL;
843 mono_runtime_create_delegate_trampoline (MonoClass *klass) MONO_INTERNAL;
846 mono_install_get_cached_class_info (MonoGetCachedClassInfo func) MONO_INTERNAL;
849 mono_install_get_class_from_name (MonoGetClassFromName func) MONO_INTERNAL;
852 mono_class_get_context (MonoClass *class) MONO_INTERNAL;
855 mono_method_get_context (MonoMethod *method) MONO_INTERNAL;
857 /* Used by monodis, thus cannot be MONO_INTERNAL */
858 MonoGenericContainer*
859 mono_method_get_generic_container (MonoMethod *method);
862 mono_generic_class_get_context (MonoGenericClass *gclass) MONO_INTERNAL;
865 mono_generic_class_get_class (MonoGenericClass *gclass) MONO_INTERNAL;
868 mono_method_set_generic_container (MonoMethod *method, MonoGenericContainer* container) MONO_INTERNAL;
871 mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context);
874 mono_method_inflated_lookup (MonoMethodInflated* method, gboolean cache) MONO_INTERNAL;
876 MonoMethodSignature *
877 mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericContext *context);
880 mono_class_inflate_generic_type_with_mempool (MonoMemPool *mempool, MonoType *type, MonoGenericContext *context) MONO_INTERNAL;
883 mono_metadata_free_inflated_signature (MonoMethodSignature *sig);
887 MonoClass *object_class;
888 MonoClass *byte_class;
889 MonoClass *void_class;
890 MonoClass *boolean_class;
891 MonoClass *sbyte_class;
892 MonoClass *int16_class;
893 MonoClass *uint16_class;
894 MonoClass *int32_class;
895 MonoClass *uint32_class;
896 MonoClass *int_class;
897 MonoClass *uint_class;
898 MonoClass *int64_class;
899 MonoClass *uint64_class;
900 MonoClass *single_class;
901 MonoClass *double_class;
902 MonoClass *char_class;
903 MonoClass *string_class;
904 MonoClass *enum_class;
905 MonoClass *array_class;
906 MonoClass *delegate_class;
907 MonoClass *multicastdelegate_class;
908 MonoClass *asyncresult_class;
909 MonoClass *waithandle_class;
910 MonoClass *typehandle_class;
911 MonoClass *fieldhandle_class;
912 MonoClass *methodhandle_class;
913 MonoClass *systemtype_class;
914 MonoClass *monotype_class;
915 MonoClass *exception_class;
916 MonoClass *threadabortexception_class;
917 MonoClass *thread_class;
918 MonoClass *transparent_proxy_class;
919 MonoClass *real_proxy_class;
920 MonoClass *mono_method_message_class;
921 MonoClass *appdomain_class;
922 MonoClass *field_info_class;
923 MonoClass *method_info_class;
924 MonoClass *stringbuilder_class;
925 MonoClass *math_class;
926 MonoClass *stack_frame_class;
927 MonoClass *stack_trace_class;
928 MonoClass *marshal_class;
929 MonoClass *iserializeable_class;
930 MonoClass *serializationinfo_class;
931 MonoClass *streamingcontext_class;
932 MonoClass *typed_reference_class;
933 MonoClass *argumenthandle_class;
934 MonoClass *marshalbyrefobject_class;
935 MonoClass *monitor_class;
936 MonoClass *iremotingtypeinfo_class;
937 MonoClass *runtimesecurityframe_class;
938 MonoClass *executioncontext_class;
939 MonoClass *internals_visible_class;
940 MonoClass *generic_ilist_class;
941 MonoClass *generic_nullable_class;
942 MonoClass *variant_class;
943 MonoClass *com_object_class;
944 MonoClass *com_interop_proxy_class;
945 MonoClass *iunknown_class;
946 MonoClass *idispatch_class;
947 MonoClass *safehandle_class;
948 MonoClass *handleref_class;
949 MonoClass *attribute_class;
950 MonoClass *customattribute_data_class;
953 extern MonoDefaults mono_defaults MONO_INTERNAL;
956 mono_loader_init (void) MONO_INTERNAL;
959 mono_loader_cleanup (void) MONO_INTERNAL;
962 mono_loader_lock (void) MONO_INTERNAL;
965 mono_loader_unlock (void) MONO_INTERNAL;
968 mono_loader_set_error_assembly_load (const char *assembly_name, gboolean ref_only) MONO_INTERNAL;
971 mono_loader_set_error_type_load (const char *class_name, const char *assembly_name) MONO_INTERNAL;
974 mono_loader_set_error_method_load (const char *class_name, const char *member_name) MONO_INTERNAL;
977 mono_loader_set_error_field_load (MonoClass *klass, const char *member_name) MONO_INTERNAL;
979 mono_loader_set_error_bad_image (char *msg) MONO_INTERNAL;
982 mono_loader_error_prepare_exception (MonoLoaderError *error) MONO_INTERNAL;
985 mono_loader_get_last_error (void) MONO_INTERNAL;
988 mono_loader_clear_error (void) MONO_INTERNAL;
991 mono_reflection_init (void) MONO_INTERNAL;
994 mono_icall_init (void) MONO_INTERNAL;
997 mono_icall_cleanup (void) MONO_INTERNAL;
1000 mono_method_get_wrapper_data (MonoMethod *method, guint32 id) MONO_INTERNAL;
1003 mono_install_stack_walk (MonoStackWalkImpl func) MONO_INTERNAL;
1006 mono_metadata_has_generic_params (MonoImage *image, guint32 token) MONO_INTERNAL;
1008 MonoGenericContainer *
1009 mono_metadata_load_generic_params (MonoImage *image, guint32 token,
1010 MonoGenericContainer *parent_container);
1013 mono_metadata_load_generic_param_constraints (MonoImage *image, guint32 token,
1014 MonoGenericContainer *container);
1016 MonoMethodSignature*
1017 mono_create_icall_signature (const char *sigstr) MONO_INTERNAL;
1020 mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save) MONO_INTERNAL;
1023 mono_register_jit_icall_wrapper (MonoJitICallInfo *info, gconstpointer wrapper) MONO_INTERNAL;
1026 mono_find_jit_icall_by_name (const char *name) MONO_INTERNAL;
1029 mono_find_jit_icall_by_addr (gconstpointer addr) MONO_INTERNAL;
1032 mono_get_jit_icall_info (void) MONO_INTERNAL;
1035 mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data) MONO_INTERNAL;
1038 mono_class_get_exception_data (MonoClass *klass) MONO_INTERNAL;
1041 mono_class_get_exception_for_failure (MonoClass *klass) MONO_INTERNAL;
1044 mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format) MONO_INTERNAL;
1047 mono_type_get_full_name (MonoClass *class) MONO_INTERNAL;
1049 MonoArrayType *mono_dup_array_type (MonoMemPool *mp, MonoArrayType *a) MONO_INTERNAL;
1050 MonoMethodSignature *mono_metadata_signature_deep_dup (MonoMemPool *mp, MonoMethodSignature *sig) MONO_INTERNAL;
1053 mono_image_init_name_cache (MonoImage *image);
1055 gboolean mono_class_is_nullable (MonoClass *klass) MONO_INTERNAL;
1056 MonoClass *mono_class_get_nullable_param (MonoClass *klass) MONO_INTERNAL;
1058 /* object debugging functions, for use inside gdb */
1059 void mono_object_describe (MonoObject *obj);
1060 void mono_object_describe_fields (MonoObject *obj);
1061 void mono_value_describe_fields (MonoClass* klass, const char* addr);
1062 void mono_class_describe_statics (MonoClass* klass);
1064 /*Enum validation related functions*/
1066 mono_type_is_valid_enum_basetype (MonoType * type);
1069 mono_class_is_valid_enum (MonoClass *klass);
1072 mono_type_get_full (MonoImage *image, guint32 type_token, MonoGenericContext *context) MONO_INTERNAL;
1075 mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass) MONO_INTERNAL;
1078 mono_method_get_declaring_generic_method (MonoMethod *method) MONO_INTERNAL;
1081 mono_class_get_method_generic (MonoClass *klass, MonoMethod *method) MONO_INTERNAL;
1084 mono_type_get_basic_type_from_generic (MonoType *type) MONO_INTERNAL;
1087 mono_class_generic_sharing_enabled (MonoClass *class) MONO_INTERNAL;
1090 mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot) MONO_INTERNAL;
1093 mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint32 slot) MONO_INTERNAL;
1095 MonoMethodRuntimeGenericContext*
1096 mono_method_lookup_rgctx (MonoVTable *class_vtable, MonoGenericInst *method_inst) MONO_INTERNAL;
1099 mono_method_needs_static_rgctx_invoke (MonoMethod *method, gboolean allow_type_vars) MONO_INTERNAL;
1102 mono_class_rgctx_get_array_size (int n, gboolean mrgctx) MONO_INTERNAL;
1105 mono_method_lookup_or_register_other_info (MonoMethod *method, gboolean in_mrgctx, gpointer data,
1106 int info_type, MonoGenericContext *generic_context) MONO_INTERNAL;
1109 mono_generic_context_check_used (MonoGenericContext *context) MONO_INTERNAL;
1112 mono_class_check_context_used (MonoClass *class) MONO_INTERNAL;
1115 mono_generic_context_is_sharable (MonoGenericContext *context, gboolean allow_type_vars) MONO_INTERNAL;
1118 mono_method_is_generic_impl (MonoMethod *method) MONO_INTERNAL;
1120 mono_method_is_generic_sharable_impl (MonoMethod *method, gboolean allow_type_vars) MONO_INTERNAL;
1123 mono_class_unregister_image_generic_subclasses (MonoImage *image) MONO_INTERNAL;
1126 mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, MonoClass *context_klass) MONO_INTERNAL;
1129 mono_method_can_access_field_full (MonoMethod *method, MonoClassField *field, MonoClass *context_klass) MONO_INTERNAL;
1132 mono_class_has_parent_and_ignore_generics (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
1135 mono_class_get_generic_type_definition (MonoClass *klass) MONO_INTERNAL;
1138 mono_method_get_vtable_slot (MonoMethod *method) MONO_INTERNAL;
1141 mono_method_get_vtable_index (MonoMethod *method) MONO_INTERNAL;
1143 #endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */