[metadata] Fix leaks when handling a few attributes (#16675)
[mono-project.git] / mono / metadata / class-internals.h
blob135465555ddb13943a5ec899e02c54d26eb7e1f2
1 /**
2 * \file
3 * Copyright 2012 Xamarin Inc
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
5 */
6 #ifndef __MONO_METADATA_CLASS_INTERNALS_H__
7 #define __MONO_METADATA_CLASS_INTERNALS_H__
9 #include <mono/metadata/class.h>
10 #include <mono/metadata/object.h>
11 #include <mono/metadata/mempool.h>
12 #include <mono/metadata/metadata-internals.h>
13 #include <mono/metadata/property-bag.h>
14 #include "mono/utils/mono-compiler.h"
15 #include "mono/utils/mono-error.h"
16 #include "mono/sgen/gc-internal-agnostic.h"
18 #define MONO_CLASS_IS_ARRAY(c) (m_class_get_rank (c))
20 #define MONO_CLASS_HAS_STATIC_METADATA(klass) (m_class_get_type_token (klass) && !m_class_get_image (klass)->dynamic && !mono_class_is_ginst (klass))
22 #define MONO_DEFAULT_SUPERTABLE_SIZE 6
24 extern gboolean mono_print_vtable;
25 extern gboolean mono_align_small_structs;
26 extern gint32 mono_simd_register_size;
28 typedef struct _MonoMethodWrapper MonoMethodWrapper;
29 typedef struct _MonoMethodInflated MonoMethodInflated;
30 typedef struct _MonoMethodPInvoke MonoMethodPInvoke;
31 typedef struct _MonoDynamicMethod MonoDynamicMethod;
33 /* Properties that applies to a group of structs should better use a higher number
34 * to avoid colision with type specific properties.
36 * This prop applies to class, method, property, event, assembly and image.
38 #define MONO_PROP_DYNAMIC_CATTR 0x1000
40 typedef enum {
41 #define WRAPPER(e,n) MONO_WRAPPER_ ## e,
42 #include "wrapper-types.h"
43 #undef WRAPPER
44 MONO_WRAPPER_NUM
45 } MonoWrapperType;
47 typedef enum {
48 MONO_TYPE_NAME_FORMAT_IL,
49 MONO_TYPE_NAME_FORMAT_REFLECTION,
50 MONO_TYPE_NAME_FORMAT_FULL_NAME,
51 MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
52 } MonoTypeNameFormat;
54 typedef enum {
55 MONO_REMOTING_TARGET_UNKNOWN,
56 MONO_REMOTING_TARGET_APPDOMAIN,
57 MONO_REMOTING_TARGET_COMINTEROP
58 } MonoRemotingTarget;
60 #define MONO_METHOD_PROP_GENERIC_CONTAINER 0
62 struct _MonoMethod {
63 guint16 flags; /* method flags */
64 guint16 iflags; /* method implementation flags */
65 guint32 token;
66 MonoClass *klass; /* To what class does this method belong */
67 MonoMethodSignature *signature;
68 /* name is useful mostly for debugging */
69 const char *name;
70 /* this is used by the inlining algorithm */
71 unsigned int inline_info:1;
72 unsigned int inline_failure:1;
73 unsigned int wrapper_type:5;
74 unsigned int string_ctor:1;
75 unsigned int save_lmf:1;
76 unsigned int dynamic:1; /* created & destroyed during runtime */
77 unsigned int sre_method:1; /* created at runtime using Reflection.Emit */
78 unsigned int is_generic:1; /* whenever this is a generic method definition */
79 unsigned int is_inflated:1; /* whether we're a MonoMethodInflated */
80 unsigned int skip_visibility:1; /* whenever to skip JIT visibility checks */
81 unsigned int verification_success:1; /* whether this method has been verified successfully.*/
82 unsigned int is_reabstracted:1; /* whenever this is a reabstraction of another interface */
83 signed int slot : 16;
86 * If is_generic is TRUE, the generic_container is stored in image->property_hash,
87 * using the key MONO_METHOD_PROP_GENERIC_CONTAINER.
91 struct _MonoMethodWrapper {
92 MonoMethod method;
93 MonoMethodHeader *header;
94 void *method_data;
97 struct _MonoDynamicMethod {
98 MonoMethodWrapper method;
99 MonoAssembly *assembly;
102 struct _MonoMethodPInvoke {
103 MonoMethod method;
104 gpointer addr;
105 /* add marshal info */
106 guint16 piflags; /* pinvoke flags */
107 guint32 implmap_idx; /* index into IMPLMAP */
111 * Stores the default value / RVA of fields.
112 * This information is rarely needed, so it is stored separately from
113 * MonoClassField.
115 typedef struct MonoFieldDefaultValue {
117 * If the field is constant, pointer to the metadata constant
118 * value.
119 * If the field has an RVA flag, pointer to the data.
120 * Else, invalid.
122 const char *data;
124 /* If the field is constant, the type of the constant. */
125 MonoTypeEnum def_type;
126 } MonoFieldDefaultValue;
129 * MonoClassField is just a runtime representation of the metadata for
130 * field, it doesn't contain the data directly. Static fields are
131 * stored in MonoVTable->data. Instance fields are allocated in the
132 * objects after the object header.
134 struct _MonoClassField {
135 /* Type of the field */
136 MonoType *type;
138 const char *name;
140 /* Type where the field was defined */
141 MonoClass *parent;
144 * Offset where this field is stored; if it is an instance
145 * field, it's the offset from the start of the object, if
146 * it's static, it's from the start of the memory chunk
147 * allocated for statics for the class.
148 * For special static fields, this is set to -1 during vtable construction.
150 int offset;
153 /* a field is ignored if it's named "_Deleted" and it has the specialname and rtspecialname flags set */
154 #define mono_field_is_deleted(field) (((field)->type->attrs & (FIELD_ATTRIBUTE_SPECIAL_NAME | FIELD_ATTRIBUTE_RT_SPECIAL_NAME)) \
155 && (strcmp (mono_field_get_name (field), "_Deleted") == 0))
157 /* a field is ignored if it's named "_Deleted" and it has the specialname and rtspecialname flags set */
158 /* Try to avoid loading the field's type */
159 #define mono_field_is_deleted_with_flags(field, flags) (((flags) & (FIELD_ATTRIBUTE_SPECIAL_NAME | FIELD_ATTRIBUTE_RT_SPECIAL_NAME)) \
160 && (strcmp (mono_field_get_name (field), "_Deleted") == 0))
162 typedef struct {
163 MonoClassField *field;
164 guint32 offset;
165 MonoMarshalSpec *mspec;
166 } MonoMarshalField;
168 typedef struct {
169 MonoPropertyBagItem head;
171 guint32 native_size, min_align;
172 guint32 num_fields;
173 MonoMethod *ptr_to_str;
174 MonoMethod *str_to_ptr;
175 MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
176 } MonoMarshalType;
178 #define MONO_SIZEOF_MARSHAL_TYPE (offsetof (MonoMarshalType, fields))
180 struct _MonoProperty {
181 MonoClass *parent;
182 const char *name;
183 MonoMethod *get;
184 MonoMethod *set;
185 guint32 attrs;
188 struct _MonoEvent {
189 MonoClass *parent;
190 const char *name;
191 MonoMethod *add;
192 MonoMethod *remove;
193 MonoMethod *raise;
194 #ifndef MONO_SMALL_CONFIG
195 MonoMethod **other;
196 #endif
197 guint32 attrs;
200 /* type of exception being "on hold" for later processing (see exception_type) */
201 typedef enum {
202 MONO_EXCEPTION_NONE = 0,
203 MONO_EXCEPTION_INVALID_PROGRAM = 3,
204 MONO_EXCEPTION_UNVERIFIABLE_IL = 4,
205 MONO_EXCEPTION_MISSING_METHOD = 5,
206 MONO_EXCEPTION_MISSING_FIELD = 6,
207 MONO_EXCEPTION_TYPE_LOAD = 7,
208 MONO_EXCEPTION_FILE_NOT_FOUND = 8,
209 MONO_EXCEPTION_METHOD_ACCESS = 9,
210 MONO_EXCEPTION_FIELD_ACCESS = 10,
211 MONO_EXCEPTION_GENERIC_SHARING_FAILED = 11,
212 MONO_EXCEPTION_BAD_IMAGE = 12,
213 MONO_EXCEPTION_OBJECT_SUPPLIED = 13, /*The exception object is already created.*/
214 MONO_EXCEPTION_OUT_OF_MEMORY = 14,
215 MONO_EXCEPTION_INLINE_FAILED = 15,
216 MONO_EXCEPTION_MONO_ERROR = 16,
217 /* add other exception type */
218 } MonoExceptionType;
220 /* This struct collects the info needed for the runtime use of a class,
221 * like the vtables for a domain, the GC descriptor, etc.
223 typedef struct {
224 guint16 max_domain;
225 /* domain_vtables is indexed by the domain id and the size is max_domain + 1 */
226 MonoVTable *domain_vtables [MONO_ZERO_LEN_ARRAY];
227 } MonoClassRuntimeInfo;
229 #define MONO_SIZEOF_CLASS_RUNTIME_INFO (sizeof (MonoClassRuntimeInfo) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
231 typedef struct {
232 MonoPropertyBagItem head;
234 MonoProperty *properties;
235 guint32 first, count;
236 MonoFieldDefaultValue *def_values;
237 } MonoClassPropertyInfo;
239 typedef struct {
240 MonoPropertyBagItem head;
242 /* Initialized by a call to mono_class_setup_events () */
243 MonoEvent *events;
244 guint32 first, count;
245 } MonoClassEventInfo;
247 typedef enum {
248 MONO_CLASS_DEF = 1, /* non-generic type */
249 MONO_CLASS_GTD, /* generic type definition */
250 MONO_CLASS_GINST, /* generic instantiation */
251 MONO_CLASS_GPARAM, /* generic parameter */
252 MONO_CLASS_ARRAY, /* vector or array, bounded or not */
253 MONO_CLASS_POINTER, /* pointer or function pointer*/
254 } MonoTypeKind;
256 typedef struct _MonoClassDef MonoClassDef;
257 typedef struct _MonoClassGtd MonoClassGtd;
258 typedef struct _MonoClassGenericInst MonoClassGenericInst;
259 typedef struct _MonoClassGenericParam MonoClassGenericParam;
260 typedef struct _MonoClassArray MonoClassArray;
261 typedef struct _MonoClassPointer MonoClassPointer;
263 union _MonoClassSizes {
264 int class_size; /* size of area for static fields */
265 int element_size; /* for array types */
266 int generic_param_token; /* for generic param types, both var and mvar */
269 /* enabled only with small config for now: we might want to do it unconditionally */
270 #ifdef MONO_SMALL_CONFIG
271 #define COMPRESSED_INTERFACE_BITMAP 1
272 #endif
275 #ifdef ENABLE_CHECKED_BUILD_PRIVATE_TYPES
276 #define MONO_CLASS_DEF_PRIVATE 1
277 #endif
279 /* Hide _MonoClass definition in checked build mode to ensure that
280 * it is only accessed via getter and setter methods.
282 #ifndef MONO_CLASS_DEF_PRIVATE
283 #include "class-private-definition.h"
284 #endif
286 /* If MonoClass definition is hidden, just declare the getters.
287 * Otherwise, define them as static inline functions.
289 #ifdef MONO_CLASS_DEF_PRIVATE
290 #define MONO_CLASS_GETTER(funcname, rettype, optref, argtype, fieldname) rettype funcname (argtype *klass);
291 #else
292 #define MONO_CLASS_GETTER(funcname, rettype, optref, argtype, fieldname) static inline rettype funcname (argtype *klass) { return optref klass-> fieldname ; }
293 #endif
294 #define MONO_CLASS_OFFSET(funcname, argtype, fieldname) /*nothing*/
295 #include "class-getters.h"
296 #undef MONO_CLASS_GETTER
297 #undef MONO_CLASS_OFFSET
299 #ifdef COMPRESSED_INTERFACE_BITMAP
300 int mono_compress_bitmap (uint8_t *dest, const uint8_t *bitmap, int size);
301 int mono_class_interface_match (const uint8_t *bitmap, int id);
302 #else
303 #define mono_class_interface_match(bmap,uiid) ((bmap) [(uiid) >> 3] & (1 << ((uiid)&7)))
304 #endif
306 #define MONO_CLASS_IMPLEMENTS_INTERFACE(k,uiid) (((uiid) <= m_class_get_max_interface_id (k)) && mono_class_interface_match (m_class_get_interface_bitmap (k), (uiid)))
308 #define MONO_VTABLE_AVAILABLE_GC_BITS 4
310 #ifdef DISABLE_REMOTING
311 #define mono_class_is_marshalbyref(klass) (FALSE)
312 #define mono_class_is_contextbound(klass) (FALSE)
313 #define mono_vtable_is_remote(vtable) (FALSE)
314 #define mono_vtable_set_is_remote(vtable,enable) do {} while (0)
315 #else
316 #define mono_class_is_marshalbyref(klass) (m_class_get_marshalbyref (klass))
317 #define mono_class_is_contextbound(klass) (m_class_get_contextbound (klass))
318 #define mono_vtable_is_remote(vtable) ((vtable)->remote)
319 #define mono_vtable_set_is_remote(vtable,enable) do { (vtable)->remote = enable ? 1 : 0; } while (0)
320 #endif
322 #ifdef DISABLE_COM
323 #define mono_class_is_com_object(klass) (FALSE)
324 #else
325 #define mono_class_is_com_object(klass) (m_class_is_com_object (klass))
326 #endif
329 MONO_API int mono_class_interface_offset (MonoClass *klass, MonoClass *itf);
330 int mono_class_interface_offset_with_variance (MonoClass *klass, MonoClass *itf, gboolean *non_exact_match);
332 typedef gpointer MonoRuntimeGenericContext;
334 typedef enum {
335 /* array or string */
336 MONO_VT_FLAG_ARRAY_OR_STRING = (1 << 0)
337 } MonoVTableFlags;
339 /* the interface_offsets array is stored in memory before this struct */
340 struct MonoVTable {
341 MonoClass *klass;
343 * According to comments in gc_gcj.h, this should be the second word in
344 * the vtable.
346 MonoGCDescriptor gc_descr;
347 MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
348 gpointer type; /* System.Type type for klass */
349 guint8 *interface_bitmap;
350 guint32 max_interface_id;
351 guint8 rank;
352 /* Keep this a guint8, the jit depends on it */
353 guint8 initialized; /* cctor has been run */
354 /* Keep this a guint8, the jit depends on it */
355 guint8 flags; /* MonoVTableFlags */
356 guint remote : 1; /* class is remotely activated */
357 guint init_failed : 1; /* cctor execution failed */
358 guint has_static_fields : 1; /* pointer to the data stored at the end of the vtable array */
359 guint gc_bits : MONO_VTABLE_AVAILABLE_GC_BITS; /* Those bits are reserved for the usaged of the GC */
361 guint32 imt_collisions_bitmap;
362 MonoRuntimeGenericContext *runtime_generic_context;
363 /* interp virtual method table */
364 gpointer *interp_vtable;
365 /* do not add any fields after vtable, the structure is dynamically extended */
366 /* vtable contains function pointers to methods or their trampolines, at the
367 end there may be a slot containing the pointer to the static fields */
368 gpointer vtable [MONO_ZERO_LEN_ARRAY];
371 #define MONO_SIZEOF_VTABLE (sizeof (MonoVTable) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
373 #define MONO_VTABLE_IMPLEMENTS_INTERFACE(vt,uiid) (((uiid) <= (vt)->max_interface_id) && mono_class_interface_match ((vt)->interface_bitmap, (uiid)))
376 * Generic instantiation data type encoding.
380 * A particular generic instantiation:
382 * All instantiations are cached and we don't distinguish between class and method
383 * instantiations here.
385 struct _MonoGenericInst {
386 #ifndef MONO_SMALL_CONFIG
387 gint32 id; /* unique ID for debugging */
388 #endif
389 guint type_argc : 22; /* number of type arguments */
390 guint is_open : 1; /* if this is an open type */
391 MonoType *type_argv [MONO_ZERO_LEN_ARRAY];
394 #define MONO_SIZEOF_GENERIC_INST (sizeof (MonoGenericInst) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
396 * The generic context: an instantiation of a set of class and method generic parameters.
398 * NOTE: Never allocate this directly on the heap. It have to be either allocated on the stack,
399 * or embedded within other objects. Don't store pointers to this, because it may be on the stack.
400 * If you really have to, ensure you store a pointer to the embedding object along with it.
402 struct _MonoGenericContext {
403 /* The instantiation corresponding to the class generic parameters */
404 MonoGenericInst *class_inst;
405 /* The instantiation corresponding to the method generic parameters */
406 MonoGenericInst *method_inst;
410 * Inflated generic method.
412 struct _MonoMethodInflated {
413 union {
414 MonoMethod method;
415 MonoMethodPInvoke pinvoke;
416 } method;
417 MonoMethod *declaring; /* the generic method definition. */
418 MonoGenericContext context; /* The current instantiation */
419 MonoImageSet *owner; /* The image set that the inflated method belongs to. */
423 * A particular instantiation of a generic type.
425 struct _MonoGenericClass {
426 MonoClass *container_class; /* the generic type definition */
427 MonoGenericContext context; /* a context that contains the type instantiation doesn't contain any method instantiation */ /* FIXME: Only the class_inst member of "context" is ever used, so this field could be replaced with just a monogenericinst */
428 guint is_dynamic : 1; /* Contains dynamic types */
429 guint is_tb_open : 1; /* This is the fully open instantiation for a type_builder. Quite ugly, but it's temporary.*/
430 guint need_sync : 1; /* Only if dynamic. Need to be synchronized with its container class after its finished. */
431 MonoClass *cached_class; /* if present, the MonoClass corresponding to the instantiation. */
434 * The image set which owns this generic class. Memory owned by the generic class
435 * including cached_class should be allocated from the mempool of the image set,
436 * so it is easy to free.
438 MonoImageSet *owner;
441 /* Additional details about a MonoGenericParam */
442 /* Keep in sync with managed Mono.RuntimeStructs.GenericParamInfo */
443 typedef struct {
444 MonoClass *pklass; /* The corresponding `MonoClass'. */
445 const char *name;
447 // See GenericParameterAttributes
448 guint16 flags;
450 guint32 token;
452 // Constraints on type parameters
453 MonoClass** constraints; /* NULL means end of list */
454 } MonoGenericParamInfo;
457 * A type parameter.
459 struct _MonoGenericParam {
461 * Type or method this parameter was defined in.
463 MonoGenericContainer *owner;
464 guint16 num;
466 * If != NULL, this is a generated generic param used by the JIT to implement generic
467 * sharing.
469 MonoType *gshared_constraint;
471 MonoGenericParamInfo info;
474 typedef MonoGenericParam MonoGenericParamFull;
477 * The generic container.
479 * Stores the type parameters of a generic type definition or a generic method definition.
481 struct _MonoGenericContainer {
482 MonoGenericContext context;
483 /* If we're a generic method definition in a generic type definition,
484 the generic container of the containing class. */
485 MonoGenericContainer *parent;
486 /* the generic type definition or the generic method definition corresponding to this container */
487 /* Union rules: If is_anonymous, image field is valid; else if is_method, method field is valid; else klass is valid. */
488 union {
489 MonoClass *klass;
490 MonoMethod *method;
491 MonoImage *image;
492 } owner;
493 int type_argc : 29; // Per the ECMA spec, this value is capped at 16 bits
494 /* If true, we're a generic method, otherwise a generic type definition. */
495 /* Invariant: parent != NULL => is_method */
496 int is_method : 1;
497 /* If true, this container has no associated class/method and only the image is known. This can happen:
498 1. For the special anonymous containers kept by MonoImage.
499 2. When user code creates a generic parameter via SRE, but has not yet set an owner. */
500 int is_anonymous : 1;
501 /* Our type parameters. If this is a special anonymous container (case 1, above), this field is not valid, use mono_metadata_create_anon_gparam () */
502 MonoGenericParamFull *type_params;
505 static inline MonoGenericParam *
506 mono_generic_container_get_param (MonoGenericContainer *gc, int i)
508 return (MonoGenericParam *) &gc->type_params [i];
511 static inline MonoGenericParamInfo *
512 mono_generic_container_get_param_info (MonoGenericContainer *gc, int i)
514 return &gc->type_params [i].info;
517 static inline MonoGenericContainer *
518 mono_generic_param_owner (MonoGenericParam *p)
520 return p->owner;
523 static inline int
524 mono_generic_param_num (MonoGenericParam *p)
526 return p->num;
529 static inline MonoGenericParamInfo *
530 mono_generic_param_info (MonoGenericParam *p)
532 return &((MonoGenericParamFull *) p)->info;
535 static inline const char *
536 mono_generic_param_name (MonoGenericParam *p)
538 return ((MonoGenericParamFull *) p)->info.name;
541 static inline MonoGenericContainer *
542 mono_type_get_generic_param_owner (MonoType *t)
544 return mono_generic_param_owner (t->data.generic_param);
547 static inline int
548 mono_type_get_generic_param_num (MonoType *t)
550 return mono_generic_param_num (t->data.generic_param);
554 * Class information which might be cached by the runtime in the AOT file for
555 * example. Caching this allows us to avoid computing a generic vtable
556 * (class->vtable) in most cases, saving time and avoiding creation of lots of
557 * MonoMethod structures.
559 typedef struct MonoCachedClassInfo {
560 guint32 vtable_size;
561 guint has_finalize : 1;
562 guint ghcimpl : 1;
563 guint has_cctor : 1;
564 guint has_nested_classes : 1;
565 guint blittable : 1;
566 guint has_references : 1;
567 guint has_static_refs : 1;
568 guint no_special_static_fields : 1;
569 guint is_generic_container : 1;
570 guint has_weak_fields : 1;
571 guint32 cctor_token;
572 MonoImage *finalize_image;
573 guint32 finalize_token;
574 guint32 instance_size;
575 guint32 class_size;
576 guint32 packing_size;
577 guint32 min_align;
578 } MonoCachedClassInfo;
580 typedef struct {
581 // Name and func fields double as "inited".
582 // That is, any initialized MonoJitICallInfo must
583 // have both of them to be non-NULL.
584 const char *name;
585 gconstpointer func;
586 gconstpointer wrapper;
587 gconstpointer trampoline;
588 MonoMethodSignature *sig;
589 const char *c_symbol;
590 MonoMethod *wrapper_method;
591 } MonoJitICallInfo;
593 void
594 mono_class_setup_supertypes (MonoClass *klass);
596 /* WARNING
597 * Only call this function if you can ensure both @klass and @parent
598 * have supertype information initialized.
599 * This can be accomplished by mono_class_setup_supertypes or mono_class_init.
600 * If unsure, use mono_class_has_parent.
602 static inline gboolean
603 mono_class_has_parent_fast (MonoClass *klass, MonoClass *parent)
605 return (m_class_get_idepth (klass) >= m_class_get_idepth (parent)) && (m_class_get_supertypes (klass) [m_class_get_idepth (parent) - 1] == parent);
608 static inline gboolean
609 mono_class_has_parent (MonoClass *klass, MonoClass *parent)
611 if (G_UNLIKELY (!m_class_get_supertypes (klass)))
612 mono_class_setup_supertypes (klass);
614 if (G_UNLIKELY (!m_class_get_supertypes (parent)))
615 mono_class_setup_supertypes (parent);
617 return mono_class_has_parent_fast (klass, parent);
620 typedef struct {
621 MonoVTable *default_vtable;
622 MonoVTable *xdomain_vtable;
623 MonoClass *proxy_class;
624 char* proxy_class_name;
625 uint32_t interface_count;
626 MonoClass *interfaces [MONO_ZERO_LEN_ARRAY];
627 } MonoRemoteClass;
629 #define MONO_SIZEOF_REMOTE_CLASS (sizeof (MonoRemoteClass) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
631 typedef struct {
632 gint32 initialized_class_count;
633 gint32 generic_vtable_count;
634 gint32 used_class_count;
635 gint32 method_count;
636 gint32 class_vtable_size;
637 gint32 class_static_data_size;
638 gint32 generic_class_count;
639 gint32 inflated_method_count;
640 gint32 inflated_type_count;
641 gint32 delegate_creations;
642 gint32 imt_tables_size;
643 gint32 imt_number_of_tables;
644 gint32 imt_number_of_methods;
645 gint32 imt_used_slots;
646 gint32 imt_slots_with_collisions;
647 gint32 imt_max_collisions_in_slot;
648 gint32 imt_method_count_when_max_collisions;
649 gint32 imt_trampolines_size;
650 gint32 jit_info_table_insert_count;
651 gint32 jit_info_table_remove_count;
652 gint32 jit_info_table_lookup_count;
653 gint32 generics_sharable_methods;
654 gint32 generics_unsharable_methods;
655 gint32 generics_shared_methods;
656 gint32 gsharedvt_methods;
657 gboolean enabled;
658 } MonoStats;
661 * new structure to hold performace counters values that are exported
662 * to managed code.
663 * Note: never remove fields from this structure and only add them to the end.
664 * Size of fields and type should not be changed as well.
666 typedef struct {
667 /* JIT category */
668 gint32 jit_methods;
669 gint32 jit_bytes;
670 gint32 jit_time;
671 gint32 jit_failures;
672 /* Exceptions category */
673 gint32 exceptions_thrown;
674 gint32 exceptions_filters;
675 gint32 exceptions_finallys;
676 gint32 exceptions_depth;
677 gint32 aspnet_requests_queued;
678 gint32 aspnet_requests;
679 /* Memory category */
680 gint32 gc_collections0;
681 gint32 gc_collections1;
682 gint32 gc_collections2;
683 gint32 gc_promotions0;
684 gint32 gc_promotions1;
685 gint32 gc_promotion_finalizers;
686 gint64 gc_gen0size;
687 gint64 gc_gen1size;
688 gint64 gc_gen2size;
689 gint32 gc_lossize;
690 gint32 gc_fin_survivors;
691 gint32 gc_num_handles;
692 gint32 gc_allocated;
693 gint32 gc_induced;
694 gint32 gc_time;
695 gint64 gc_total_bytes;
696 gint64 gc_committed_bytes;
697 gint64 gc_reserved_bytes;
698 gint32 gc_num_pinned;
699 gint32 gc_sync_blocks;
700 /* Remoting category */
701 gint32 remoting_calls;
702 gint32 remoting_channels;
703 gint32 remoting_proxies;
704 gint32 remoting_classes;
705 gint32 remoting_objects;
706 gint32 remoting_contexts;
707 /* Loader category */
708 gint32 loader_classes;
709 gint32 loader_total_classes;
710 gint32 loader_appdomains;
711 gint32 loader_total_appdomains;
712 gint32 loader_assemblies;
713 gint32 loader_total_assemblies;
714 gint32 loader_failures;
715 gint32 loader_bytes;
716 gint32 loader_appdomains_uloaded;
717 /* Threads and Locks category */
718 gint32 thread_contentions;
719 gint32 thread_queue_len;
720 gint32 thread_queue_max;
721 gint32 thread_num_logical;
722 gint32 thread_num_physical;
723 gint32 thread_cur_recognized;
724 gint32 thread_num_recognized;
725 /* Interop category */
726 gint32 interop_num_ccw;
727 gint32 interop_num_stubs;
728 gint32 interop_num_marshals;
729 /* Security category */
730 gint32 security_num_checks;
731 gint32 security_num_link_checks;
732 gint32 security_time;
733 gint32 security_depth;
734 gint32 unused;
735 /* Threadpool */
736 gint32 threadpool_threads;
737 gint64 threadpool_workitems;
738 gint64 threadpool_ioworkitems;
739 gint32 threadpool_iothreads;
740 } MonoPerfCounters;
742 extern MonoPerfCounters *mono_perfcounters;
744 MONO_API void mono_perfcounters_init (void);
747 * The definition of the first field in SafeHandle,
748 * Keep in sync with SafeHandle.cs, this is only used
749 * to access the `handle' parameter.
751 typedef struct {
752 MonoObject base;
753 void *handle;
754 } MonoSafeHandle;
757 * Keep in sync with HandleRef.cs
759 typedef struct {
760 MonoObject *wrapper;
761 void *handle;
762 } MonoHandleRef;
764 extern MonoStats mono_stats;
766 typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
768 typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
770 static inline gboolean
771 method_is_dynamic (MonoMethod *method)
773 #ifdef DISABLE_REFLECTION_EMIT
774 return FALSE;
775 #else
776 return method->dynamic;
777 #endif
780 MonoMethod*
781 mono_class_get_method_by_index (MonoClass *klass, int index);
783 MonoMethod*
784 mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method, MonoError *error);
786 MonoMethod*
787 mono_class_get_vtable_entry (MonoClass *klass, int offset);
789 GPtrArray*
790 mono_class_get_implemented_interfaces (MonoClass *klass, MonoError *error);
793 mono_class_get_vtable_size (MonoClass *klass);
795 gboolean
796 mono_class_is_open_constructed_type (MonoType *t);
798 void
799 mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides, MonoGenericContext *generic_context, MonoError *error);
801 MonoMethod*
802 mono_class_get_cctor (MonoClass *klass) MONO_LLVM_INTERNAL;
804 MonoMethod*
805 mono_class_get_finalizer (MonoClass *klass);
807 gboolean
808 mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller);
810 gboolean
811 mono_class_field_is_special_static (MonoClassField *field);
813 guint32
814 mono_class_field_get_special_static_type (MonoClassField *field);
816 gboolean
817 mono_class_has_special_static_fields (MonoClass *klass);
819 const char*
820 mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_type);
822 MonoProperty*
823 mono_class_get_property_from_name_internal (MonoClass *klass, const char *name);
825 const char*
826 mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def_type);
828 gpointer
829 mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error);
831 gpointer
832 mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, gboolean check_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
834 gpointer
835 mono_runtime_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper, MonoError *error);
837 gpointer
838 mono_runtime_create_delegate_trampoline (MonoClass *klass);
840 void
841 mono_install_get_cached_class_info (MonoGetCachedClassInfo func);
843 void
844 mono_install_get_class_from_name (MonoGetClassFromName func);
846 MONO_PROFILER_API MonoGenericContext*
847 mono_class_get_context (MonoClass *klass);
849 MONO_PROFILER_API MonoMethodSignature*
850 mono_method_signature_checked (MonoMethod *m, MonoError *err);
852 MONO_PROFILER_API MonoMethodSignature*
853 mono_method_signature_internal (MonoMethod *m);
855 MonoGenericContext*
856 mono_method_get_context_general (MonoMethod *method, gboolean uninflated);
858 MONO_PROFILER_API MonoGenericContext*
859 mono_method_get_context (MonoMethod *method);
861 /* Used by monodis, thus cannot be MONO_INTERNAL */
862 MONO_API MonoGenericContainer*
863 mono_method_get_generic_container (MonoMethod *method);
865 MonoGenericContext*
866 mono_generic_class_get_context (MonoGenericClass *gclass);
868 void
869 mono_method_set_generic_container (MonoMethod *method, MonoGenericContainer* container);
871 MonoMethod*
872 mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context, MonoError *error);
874 MonoMethod *
875 mono_class_inflate_generic_method_checked (MonoMethod *method, MonoGenericContext *context, MonoError *error);
877 MonoImageSet *
878 mono_metadata_get_image_set_for_class (MonoClass *klass);
880 MonoImageSet *
881 mono_metadata_get_image_set_for_method (MonoMethodInflated *method);
883 MONO_API MonoMethodSignature *
884 mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericContext *context);
886 MonoType*
887 mono_class_inflate_generic_type_with_mempool (MonoImage *image, MonoType *type, MonoGenericContext *context, MonoError *error);
889 MonoType*
890 mono_class_inflate_generic_type_checked (MonoType *type, MonoGenericContext *context, MonoError *error);
892 MONO_API void
893 mono_metadata_free_inflated_signature (MonoMethodSignature *sig);
895 MonoMethodSignature*
896 mono_inflate_generic_signature (MonoMethodSignature *sig, MonoGenericContext *context, MonoError *error);
898 MonoClass*
899 mono_generic_param_get_base_type (MonoClass *klass);
901 typedef struct {
902 MonoImage *corlib;
903 MonoClass *object_class;
904 MonoClass *byte_class;
905 MonoClass *void_class;
906 MonoClass *boolean_class;
907 MonoClass *sbyte_class;
908 MonoClass *int16_class;
909 MonoClass *uint16_class;
910 MonoClass *int32_class;
911 MonoClass *uint32_class;
912 MonoClass *int_class;
913 MonoClass *uint_class;
914 MonoClass *int64_class;
915 MonoClass *uint64_class;
916 MonoClass *single_class;
917 MonoClass *double_class;
918 MonoClass *char_class;
919 MonoClass *string_class;
920 MonoClass *enum_class;
921 MonoClass *array_class;
922 MonoClass *delegate_class;
923 MonoClass *multicastdelegate_class;
924 MonoClass *manualresetevent_class;
925 MonoClass *typehandle_class;
926 MonoClass *fieldhandle_class;
927 MonoClass *methodhandle_class;
928 MonoClass *systemtype_class;
929 MonoClass *runtimetype_class;
930 MonoClass *exception_class;
931 MonoClass *threadabortexception_class;
932 MonoClass *thread_class;
933 MonoClass *internal_thread_class;
934 #ifndef DISABLE_REMOTING
935 MonoClass *transparent_proxy_class;
936 MonoClass *real_proxy_class;
937 MonoClass *marshalbyrefobject_class;
938 MonoClass *iremotingtypeinfo_class;
939 #endif
940 MonoClass *mono_method_message_class;
941 MonoClass *appdomain_class;
942 MonoClass *field_info_class;
943 MonoClass *method_info_class;
944 MonoClass *stack_frame_class;
945 MonoClass *marshal_class;
946 MonoClass *typed_reference_class;
947 MonoClass *argumenthandle_class;
948 MonoClass *monitor_class;
949 MonoClass *generic_ilist_class;
950 MonoClass *generic_nullable_class;
951 MonoClass *attribute_class;
952 MonoClass *critical_finalizer_object; /* MAYBE NULL */
953 MonoClass *generic_ireadonlylist_class;
954 MonoClass *generic_ienumerator_class;
955 MonoMethod *threadpool_perform_wait_callback_method;
956 } MonoDefaults;
958 #ifdef DISABLE_REMOTING
959 #define mono_class_is_transparent_proxy(klass) (FALSE)
960 #define mono_class_is_real_proxy(klass) (FALSE)
961 #else
962 #define mono_class_is_transparent_proxy(klass) ((klass) == mono_defaults.transparent_proxy_class)
963 #define mono_class_is_real_proxy(klass) ((klass) == mono_defaults.real_proxy_class)
964 #endif
966 #define mono_object_is_transparent_proxy(object) (mono_class_is_transparent_proxy (mono_object_class (object)))
969 #define GENERATE_GET_CLASS_WITH_CACHE_DECL(shortname) \
970 MonoClass* mono_class_get_##shortname##_class (void);
972 #define GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(shortname) \
973 MonoClass* mono_class_try_get_##shortname##_class (void);
975 #define GENERATE_GET_CLASS_WITH_CACHE(shortname,name_space,name) \
976 MonoClass* \
977 mono_class_get_##shortname##_class (void) \
979 static MonoClass *tmp_class; \
980 MonoClass *klass = tmp_class; \
981 if (!klass) { \
982 klass = mono_class_load_from_name (mono_defaults.corlib, name_space, name); \
983 mono_memory_barrier (); \
984 tmp_class = klass; \
986 return klass; \
989 #define GENERATE_TRY_GET_CLASS_WITH_CACHE(shortname,name_space,name) \
990 MonoClass* \
991 mono_class_try_get_##shortname##_class (void) \
993 static volatile MonoClass *tmp_class; \
994 static volatile gboolean inited; \
995 MonoClass *klass = (MonoClass *)tmp_class; \
996 mono_memory_barrier (); \
997 if (!inited) { \
998 klass = mono_class_try_load_from_name (mono_defaults.corlib, name_space, name); \
999 tmp_class = klass; \
1000 mono_memory_barrier (); \
1001 inited = TRUE; \
1003 return klass; \
1006 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (safehandle)
1008 #ifndef DISABLE_COM
1010 GENERATE_GET_CLASS_WITH_CACHE_DECL (interop_proxy)
1011 GENERATE_GET_CLASS_WITH_CACHE_DECL (idispatch)
1012 GENERATE_GET_CLASS_WITH_CACHE_DECL (iunknown)
1013 GENERATE_GET_CLASS_WITH_CACHE_DECL (com_object)
1014 GENERATE_GET_CLASS_WITH_CACHE_DECL (variant)
1016 #endif
1018 GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain)
1019 GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain_setup)
1021 GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain_unloaded_exception)
1022 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (appdomain_unloaded_exception)
1024 GENERATE_GET_CLASS_WITH_CACHE_DECL (valuetype)
1026 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(handleref)
1028 #ifdef ENABLE_NETCORE
1029 GENERATE_GET_CLASS_WITH_CACHE_DECL (assembly_load_context)
1030 #endif
1032 /* If you need a MonoType, use one of the mono_get_*_type () functions in class-inlines.h */
1033 extern MonoDefaults mono_defaults;
1035 void
1036 mono_loader_init (void);
1038 void
1039 mono_loader_cleanup (void);
1041 void
1042 mono_loader_lock (void) MONO_LLVM_INTERNAL;
1044 void
1045 mono_loader_unlock (void) MONO_LLVM_INTERNAL;
1047 void
1048 mono_loader_lock_track_ownership (gboolean track);
1050 gboolean
1051 mono_loader_lock_is_owned_by_self (void);
1053 void
1054 mono_loader_lock_if_inited (void);
1056 void
1057 mono_loader_unlock_if_inited (void);
1059 void
1060 mono_reflection_init (void);
1062 void
1063 mono_icall_init (void);
1065 void
1066 mono_icall_cleanup (void);
1068 gpointer
1069 mono_method_get_wrapper_data (MonoMethod *method, guint32 id);
1071 gboolean
1072 mono_metadata_has_generic_params (MonoImage *image, guint32 token);
1074 MONO_API MonoGenericContainer *
1075 mono_metadata_load_generic_params (MonoImage *image, guint32 token,
1076 MonoGenericContainer *parent_container,
1077 gpointer real_owner);
1079 MONO_API gboolean
1080 mono_metadata_load_generic_param_constraints_checked (MonoImage *image, guint32 token,
1081 MonoGenericContainer *container, MonoError *error);
1083 // This is the "real" function for registering JIT icalls. All others are one line wrappers that call it,
1084 // i.e. filling in info or c_symbol.
1085 void
1086 mono_register_jit_icall_info (MonoJitICallInfo *info, gconstpointer func, const char *name,
1087 MonoMethodSignature *sig, gboolean no_wrapper, const char *c_symbol);
1089 #ifdef __cplusplus
1090 template <typename T>
1091 inline void
1092 mono_register_jit_icall_info (MonoJitICallInfo *info, T func, const char *name, MonoMethodSignature *sig, gboolean no_wrapper, const char *c_symbol)
1094 mono_register_jit_icall_info (info, (gconstpointer)func, name, sig, no_wrapper, c_symbol);
1096 #endif // __cplusplus
1098 #define mono_register_jit_icall(func, sig, no_wrapper) (mono_register_jit_icall_info (&mono_get_jit_icall_info ()->func, func, #func, (sig), (no_wrapper), NULL))
1100 gboolean
1101 mono_class_set_type_load_failure (MonoClass *klass, const char * fmt, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
1103 MonoException*
1104 mono_class_get_exception_for_failure (MonoClass *klass);
1106 char*
1107 mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
1109 char*
1110 mono_type_get_full_name (MonoClass *klass);
1112 char *
1113 mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret, MonoTypeNameFormat format);
1115 MONO_PROFILER_API char *
1116 mono_method_get_full_name (MonoMethod *method);
1118 const char*
1119 mono_wrapper_type_to_str (guint32 wrapper_type);
1121 MonoArrayType *mono_dup_array_type (MonoImage *image, MonoArrayType *a);
1122 MonoMethodSignature *mono_metadata_signature_deep_dup (MonoImage *image, MonoMethodSignature *sig);
1124 MONO_API void
1125 mono_image_init_name_cache (MonoImage *image);
1127 MonoClass*
1128 mono_class_get_nullable_param_internal (MonoClass *klass);
1130 /* object debugging functions, for use inside gdb */
1131 MONO_API void mono_object_describe (MonoObject *obj);
1132 MONO_API void mono_object_describe_fields (MonoObject *obj);
1133 MONO_API void mono_value_describe_fields (MonoClass* klass, const char* addr);
1134 MONO_API void mono_class_describe_statics (MonoClass* klass);
1136 /* method debugging functions, for use inside gdb */
1137 MONO_API void mono_method_print_code (MonoMethod *method);
1139 MONO_PROFILER_API char *mono_signature_full_name (MonoMethodSignature *sig);
1141 /*Enum validation related functions*/
1142 MONO_API gboolean
1143 mono_type_is_valid_enum_basetype (MonoType * type);
1145 MONO_API gboolean
1146 mono_class_is_valid_enum (MonoClass *klass);
1148 MONO_PROFILER_API gboolean
1149 mono_type_is_primitive (MonoType *type);
1151 MonoType *
1152 mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
1154 gboolean
1155 mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass);
1157 MonoType*
1158 mono_type_get_basic_type_from_generic (MonoType *type);
1160 gboolean
1161 mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, MonoClass *context_klass);
1163 gboolean
1164 mono_method_can_access_field_full (MonoMethod *method, MonoClassField *field, MonoClass *context_klass);
1166 gboolean
1167 mono_class_can_access_class (MonoClass *access_class, MonoClass *target_class);
1169 MonoClass *
1170 mono_class_get_generic_type_definition (MonoClass *klass);
1172 gboolean
1173 mono_class_has_parent_and_ignore_generics (MonoClass *klass, MonoClass *parent);
1176 mono_method_get_vtable_slot (MonoMethod *method);
1179 mono_method_get_vtable_index (MonoMethod *method);
1181 MonoMethod*
1182 mono_method_get_base_method (MonoMethod *method, gboolean definition, MonoError *error);
1184 MonoMethod*
1185 mono_method_search_in_array_class (MonoClass *klass, const char *name, MonoMethodSignature *sig);
1187 void
1188 mono_class_setup_interface_id (MonoClass *klass);
1190 MonoGenericContainer*
1191 mono_class_get_generic_container (MonoClass *klass);
1193 gpointer
1194 mono_class_alloc (MonoClass *klass, int size);
1196 gpointer
1197 mono_class_alloc0 (MonoClass *klass, int size);
1199 #define mono_class_alloc0(klass, size) (g_cast (mono_class_alloc0 ((klass), (size))))
1201 void
1202 mono_class_setup_interfaces (MonoClass *klass, MonoError *error);
1204 MonoClassField*
1205 mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoType *type);
1207 MonoVTable*
1208 mono_class_vtable_checked (MonoDomain *domain, MonoClass *klass, MonoError *error);
1210 void
1211 mono_class_is_assignable_from_checked (MonoClass *klass, MonoClass *oklass, gboolean *result, MonoError *error);
1213 gboolean
1214 mono_class_is_assignable_from_slow (MonoClass *target, MonoClass *candidate);
1216 gboolean
1217 mono_class_has_variant_generic_params (MonoClass *klass);
1219 gboolean
1220 mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass, gboolean check_for_reference_conv);
1222 gboolean
1223 mono_class_is_subclass_of_internal (MonoClass *klass, MonoClass *klassc, gboolean check_interfaces);
1225 mono_bool
1226 mono_class_is_assignable_from_internal (MonoClass *klass, MonoClass *oklass);
1228 gboolean mono_is_corlib_image (MonoImage *image);
1230 MonoType*
1231 mono_field_get_type_checked (MonoClassField *field, MonoError *error);
1233 MonoType*
1234 mono_field_get_type_internal (MonoClassField *field);
1236 MonoClassField*
1237 mono_class_get_fields_internal (MonoClass* klass, gpointer *iter);
1239 MonoClassField*
1240 mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter);
1242 gboolean
1243 mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup);
1245 gboolean
1246 mono_class_has_finalizer (MonoClass *klass);
1248 void
1249 mono_unload_interface_id (MonoClass *klass);
1251 GPtrArray*
1252 mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, guint32 mlisttype, gboolean allow_ctors, MonoError *error);
1254 char*
1255 mono_class_full_name (MonoClass *klass);
1257 MonoClass*
1258 mono_class_inflate_generic_class_checked (MonoClass *gklass, MonoGenericContext *context, MonoError *error);
1260 MONO_PROFILER_API MonoClass *
1261 mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error);
1263 MonoClass *
1264 mono_class_get_and_inflate_typespec_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
1266 MonoClass *
1267 mono_class_from_name_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error);
1269 MonoClass *
1270 mono_class_from_name_case_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error);
1272 MONO_PROFILER_API MonoClass *
1273 mono_class_from_mono_type_internal (MonoType *type);
1275 MonoClassField*
1276 mono_field_from_token_checked (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context, MonoError *error);
1278 gpointer
1279 mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
1281 MonoImage *
1282 mono_get_image_for_generic_param (MonoGenericParam *param);
1284 char *
1285 mono_make_generic_name_string (MonoImage *image, int num);
1287 MonoClass *
1288 mono_class_load_from_name (MonoImage *image, const char* name_space, const char *name) MONO_LLVM_INTERNAL;
1290 MonoClass*
1291 mono_class_try_load_from_name (MonoImage *image, const char* name_space, const char *name);
1293 void
1294 mono_error_set_for_class_failure (MonoError *orerror, const MonoClass *klass);
1296 gboolean
1297 mono_class_has_failure (const MonoClass *klass);
1299 /* Kind specific accessors */
1300 MonoGenericClass*
1301 mono_class_get_generic_class (MonoClass *klass) MONO_LLVM_INTERNAL;
1303 MonoGenericClass*
1304 mono_class_try_get_generic_class (MonoClass *klass);
1306 void
1307 mono_class_set_flags (MonoClass *klass, guint32 flags);
1309 MonoGenericContainer*
1310 mono_class_try_get_generic_container (MonoClass *klass);
1312 void
1313 mono_class_set_generic_container (MonoClass *klass, MonoGenericContainer *container);
1315 MonoType*
1316 mono_class_gtd_get_canonical_inst (MonoClass *klass);
1318 guint32
1319 mono_class_get_first_method_idx (MonoClass *klass);
1321 void
1322 mono_class_set_first_method_idx (MonoClass *klass, guint32 idx);
1324 guint32
1325 mono_class_get_first_field_idx (MonoClass *klass);
1327 void
1328 mono_class_set_first_field_idx (MonoClass *klass, guint32 idx);
1330 guint32
1331 mono_class_get_method_count (MonoClass *klass);
1333 void
1334 mono_class_set_method_count (MonoClass *klass, guint32 count);
1336 guint32
1337 mono_class_get_field_count (MonoClass *klass);
1339 void
1340 mono_class_set_field_count (MonoClass *klass, guint32 count);
1342 MonoMarshalType*
1343 mono_class_get_marshal_info (MonoClass *klass);
1345 void
1346 mono_class_set_marshal_info (MonoClass *klass, MonoMarshalType *marshal_info);
1348 guint32
1349 mono_class_get_ref_info_handle (MonoClass *klass);
1351 guint32
1352 mono_class_set_ref_info_handle (MonoClass *klass, guint32 value);
1354 MonoErrorBoxed*
1355 mono_class_get_exception_data (MonoClass *klass);
1357 void
1358 mono_class_set_exception_data (MonoClass *klass, MonoErrorBoxed *value);
1360 GList*
1361 mono_class_get_nested_classes_property (MonoClass *klass);
1363 void
1364 mono_class_set_nested_classes_property (MonoClass *klass, GList *value);
1366 MonoClassPropertyInfo*
1367 mono_class_get_property_info (MonoClass *klass);
1369 void
1370 mono_class_set_property_info (MonoClass *klass, MonoClassPropertyInfo *info);
1372 MonoClassEventInfo*
1373 mono_class_get_event_info (MonoClass *klass);
1375 void
1376 mono_class_set_event_info (MonoClass *klass, MonoClassEventInfo *info);
1378 MonoFieldDefaultValue*
1379 mono_class_get_field_def_values (MonoClass *klass);
1381 void
1382 mono_class_set_field_def_values (MonoClass *klass, MonoFieldDefaultValue *values);
1384 guint32
1385 mono_class_get_declsec_flags (MonoClass *klass);
1387 void
1388 mono_class_set_declsec_flags (MonoClass *klass, guint32 value);
1390 void
1391 mono_class_set_is_com_object (MonoClass *klass);
1393 void
1394 mono_class_set_weak_bitmap (MonoClass *klass, int nbits, gsize *bits);
1396 gsize*
1397 mono_class_get_weak_bitmap (MonoClass *klass, int *nbits);
1399 gboolean
1400 mono_class_has_dim_conflicts (MonoClass *klass);
1402 void
1403 mono_class_set_dim_conflicts (MonoClass *klass, GSList *conflicts);
1405 GSList*
1406 mono_class_get_dim_conflicts (MonoClass *klass);
1408 MonoMethod *
1409 mono_class_get_method_from_name_checked (MonoClass *klass, const char *name, int param_count, int flags, MonoError *error);
1411 gboolean
1412 mono_method_has_no_body (MonoMethod *method);
1414 // FIXME Replace all internal callers of mono_method_get_header_checked with
1415 // mono_method_get_header_internal; the difference is in error initialization.
1417 // And then mark mono_method_get_header_checked as MONO_RT_EXTERNAL_ONLY MONO_API.
1419 // Internal callers expected to use ERROR_DECL. External callers are not.
1420 MonoMethodHeader*
1421 mono_method_get_header_internal (MonoMethod *method, MonoError *error);
1423 MonoType*
1424 mono_class_find_enum_basetype (MonoClass *klass, MonoError *error);
1426 gboolean
1427 mono_class_set_failure (MonoClass *klass, MonoErrorBoxed *boxed_error);
1429 gboolean
1430 mono_class_set_type_load_failure_causedby_class (MonoClass *klass, const MonoClass *caused_by, const gchar* msg);
1432 gboolean mono_class_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res);
1434 MonoMethod* mono_find_method_in_metadata (MonoClass *klass, const char *name, int param_count, int flags);
1437 mono_class_get_object_finalize_slot (void);
1439 MonoMethod *
1440 mono_class_get_default_finalize_method (void);
1442 void
1443 mono_field_resolve_type (MonoClassField *field, MonoError *error);
1445 gboolean
1446 mono_type_has_exceptions (MonoType *type);
1448 void
1449 mono_class_set_nonblittable (MonoClass *klass);
1451 gboolean
1452 mono_class_publish_gc_descriptor (MonoClass *klass, MonoGCDescriptor gc_descr);
1454 void
1455 mono_class_compute_gc_descriptor (MonoClass *klass);
1457 #ifndef DISABLE_REMOTING
1458 void
1459 mono_class_contextbound_bit_offset (int* byte_offset_out, guint8* mask_out);
1460 #endif
1462 gboolean
1463 mono_class_init_checked (MonoClass *klass, MonoError *error);
1465 MonoType*
1466 mono_class_enum_basetype_internal (MonoClass *klass) MONO_LLVM_INTERNAL;
1468 // Enum and static storage for JIT icalls.
1469 #include "jit-icall-reg.h"
1471 /*Now that everything has been defined, let's include the inline functions */
1472 #include <mono/metadata/class-inlines.h>
1474 #endif /* __MONO_METADATA_CLASS_INTERNALS_H__ */