[coop] Transition various public APIs into an external/internal form to avoid unneces...
[mono-project.git] / mono / metadata / class-internals.h
blobf5a32267f07668c5ea6b4d9d861e79bfb13286aa
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;
27 typedef struct _MonoMethodWrapper MonoMethodWrapper;
28 typedef struct _MonoMethodInflated MonoMethodInflated;
29 typedef struct _MonoMethodPInvoke MonoMethodPInvoke;
30 typedef struct _MonoDynamicMethod MonoDynamicMethod;
32 /* Properties that applies to a group of structs should better use a higher number
33 * to avoid colision with type specific properties.
35 * This prop applies to class, method, property, event, assembly and image.
37 #define MONO_PROP_DYNAMIC_CATTR 0x1000
39 typedef enum {
40 #define WRAPPER(e,n) MONO_WRAPPER_ ## e,
41 #include "wrapper-types.h"
42 #undef WRAPPER
43 MONO_WRAPPER_NUM
44 } MonoWrapperType;
46 typedef enum {
47 MONO_TYPE_NAME_FORMAT_IL,
48 MONO_TYPE_NAME_FORMAT_REFLECTION,
49 MONO_TYPE_NAME_FORMAT_FULL_NAME,
50 MONO_TYPE_NAME_FORMAT_ASSEMBLY_QUALIFIED
51 } MonoTypeNameFormat;
53 typedef enum {
54 MONO_REMOTING_TARGET_UNKNOWN,
55 MONO_REMOTING_TARGET_APPDOMAIN,
56 MONO_REMOTING_TARGET_COMINTEROP
57 } MonoRemotingTarget;
59 #define MONO_METHOD_PROP_GENERIC_CONTAINER 0
61 struct _MonoMethod {
62 guint16 flags; /* method flags */
63 guint16 iflags; /* method implementation flags */
64 guint32 token;
65 MonoClass *klass; /* To what class does this method belong */
66 MonoMethodSignature *signature;
67 /* name is useful mostly for debugging */
68 const char *name;
69 /* this is used by the inlining algorithm */
70 unsigned int inline_info:1;
71 unsigned int inline_failure:1;
72 unsigned int wrapper_type:5;
73 unsigned int string_ctor:1;
74 unsigned int save_lmf:1;
75 unsigned int dynamic:1; /* created & destroyed during runtime */
76 unsigned int sre_method:1; /* created at runtime using Reflection.Emit */
77 unsigned int is_generic:1; /* whenever this is a generic method definition */
78 unsigned int is_inflated:1; /* whether we're a MonoMethodInflated */
79 unsigned int skip_visibility:1; /* whenever to skip JIT visibility checks */
80 unsigned int verification_success:1; /* whether this method has been verified successfully.*/
81 signed int slot : 16;
84 * If is_generic is TRUE, the generic_container is stored in image->property_hash,
85 * using the key MONO_METHOD_PROP_GENERIC_CONTAINER.
89 struct _MonoMethodWrapper {
90 MonoMethod method;
91 MonoMethodHeader *header;
92 void *method_data;
95 struct _MonoDynamicMethod {
96 MonoMethodWrapper method;
97 MonoAssembly *assembly;
100 struct _MonoMethodPInvoke {
101 MonoMethod method;
102 gpointer addr;
103 /* add marshal info */
104 guint16 piflags; /* pinvoke flags */
105 guint32 implmap_idx; /* index into IMPLMAP */
109 * Stores the default value / RVA of fields.
110 * This information is rarely needed, so it is stored separately from
111 * MonoClassField.
113 typedef struct MonoFieldDefaultValue {
115 * If the field is constant, pointer to the metadata constant
116 * value.
117 * If the field has an RVA flag, pointer to the data.
118 * Else, invalid.
120 const char *data;
122 /* If the field is constant, the type of the constant. */
123 MonoTypeEnum def_type;
124 } MonoFieldDefaultValue;
127 * MonoClassField is just a runtime representation of the metadata for
128 * field, it doesn't contain the data directly. Static fields are
129 * stored in MonoVTable->data. Instance fields are allocated in the
130 * objects after the object header.
132 struct _MonoClassField {
133 /* Type of the field */
134 MonoType *type;
136 const char *name;
138 /* Type where the field was defined */
139 MonoClass *parent;
142 * Offset where this field is stored; if it is an instance
143 * field, it's the offset from the start of the object, if
144 * it's static, it's from the start of the memory chunk
145 * allocated for statics for the class.
146 * For special static fields, this is set to -1 during vtable construction.
148 int offset;
151 /* a field is ignored if it's named "_Deleted" and it has the specialname and rtspecialname flags set */
152 #define mono_field_is_deleted(field) (((field)->type->attrs & (FIELD_ATTRIBUTE_SPECIAL_NAME | FIELD_ATTRIBUTE_RT_SPECIAL_NAME)) \
153 && (strcmp (mono_field_get_name (field), "_Deleted") == 0))
155 /* a field is ignored if it's named "_Deleted" and it has the specialname and rtspecialname flags set */
156 /* Try to avoid loading the field's type */
157 #define mono_field_is_deleted_with_flags(field, flags) (((flags) & (FIELD_ATTRIBUTE_SPECIAL_NAME | FIELD_ATTRIBUTE_RT_SPECIAL_NAME)) \
158 && (strcmp (mono_field_get_name (field), "_Deleted") == 0))
160 typedef struct {
161 MonoClassField *field;
162 guint32 offset;
163 MonoMarshalSpec *mspec;
164 } MonoMarshalField;
166 typedef struct {
167 MonoPropertyBagItem head;
169 guint32 native_size, min_align;
170 guint32 num_fields;
171 MonoMethod *ptr_to_str;
172 MonoMethod *str_to_ptr;
173 MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
174 } MonoMarshalType;
176 #define MONO_SIZEOF_MARSHAL_TYPE (offsetof (MonoMarshalType, fields))
178 struct _MonoProperty {
179 MonoClass *parent;
180 const char *name;
181 MonoMethod *get;
182 MonoMethod *set;
183 guint32 attrs;
186 struct _MonoEvent {
187 MonoClass *parent;
188 const char *name;
189 MonoMethod *add;
190 MonoMethod *remove;
191 MonoMethod *raise;
192 #ifndef MONO_SMALL_CONFIG
193 MonoMethod **other;
194 #endif
195 guint32 attrs;
198 /* type of exception being "on hold" for later processing (see exception_type) */
199 typedef enum {
200 MONO_EXCEPTION_NONE = 0,
201 MONO_EXCEPTION_INVALID_PROGRAM = 3,
202 MONO_EXCEPTION_UNVERIFIABLE_IL = 4,
203 MONO_EXCEPTION_MISSING_METHOD = 5,
204 MONO_EXCEPTION_MISSING_FIELD = 6,
205 MONO_EXCEPTION_TYPE_LOAD = 7,
206 MONO_EXCEPTION_FILE_NOT_FOUND = 8,
207 MONO_EXCEPTION_METHOD_ACCESS = 9,
208 MONO_EXCEPTION_FIELD_ACCESS = 10,
209 MONO_EXCEPTION_GENERIC_SHARING_FAILED = 11,
210 MONO_EXCEPTION_BAD_IMAGE = 12,
211 MONO_EXCEPTION_OBJECT_SUPPLIED = 13, /*The exception object is already created.*/
212 MONO_EXCEPTION_OUT_OF_MEMORY = 14,
213 MONO_EXCEPTION_INLINE_FAILED = 15,
214 MONO_EXCEPTION_MONO_ERROR = 16,
215 /* add other exception type */
216 } MonoExceptionType;
218 /* This struct collects the info needed for the runtime use of a class,
219 * like the vtables for a domain, the GC descriptor, etc.
221 typedef struct {
222 guint16 max_domain;
223 /* domain_vtables is indexed by the domain id and the size is max_domain + 1 */
224 MonoVTable *domain_vtables [MONO_ZERO_LEN_ARRAY];
225 } MonoClassRuntimeInfo;
227 #define MONO_SIZEOF_CLASS_RUNTIME_INFO (sizeof (MonoClassRuntimeInfo) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
229 typedef struct {
230 MonoPropertyBagItem head;
232 MonoProperty *properties;
233 guint32 first, count;
234 MonoFieldDefaultValue *def_values;
235 } MonoClassPropertyInfo;
237 typedef struct {
238 MonoPropertyBagItem head;
240 /* Initialized by a call to mono_class_setup_events () */
241 MonoEvent *events;
242 guint32 first, count;
243 } MonoClassEventInfo;
245 typedef enum {
246 MONO_CLASS_DEF = 1, /* non-generic type */
247 MONO_CLASS_GTD, /* generic type definition */
248 MONO_CLASS_GINST, /* generic instantiation */
249 MONO_CLASS_GPARAM, /* generic parameter */
250 MONO_CLASS_ARRAY, /* vector or array, bounded or not */
251 MONO_CLASS_POINTER, /* pointer of function pointer*/
252 } MonoTypeKind;
254 typedef struct _MonoClassDef MonoClassDef;
255 typedef struct _MonoClassGtd MonoClassGtd;
256 typedef struct _MonoClassGenericInst MonoClassGenericInst;
257 typedef struct _MonoClassGenericParam MonoClassGenericParam;
258 typedef struct _MonoClassArray MonoClassArray;
259 typedef struct _MonoClassPointer MonoClassPointer;
261 union _MonoClassSizes {
262 int class_size; /* size of area for static fields */
263 int element_size; /* for array types */
264 int generic_param_token; /* for generic param types, both var and mvar */
267 /* enabled only with small config for now: we might want to do it unconditionally */
268 #ifdef MONO_SMALL_CONFIG
269 #define COMPRESSED_INTERFACE_BITMAP 1
270 #endif
273 #ifdef ENABLE_CHECKED_BUILD_PRIVATE_TYPES
274 #define MONO_CLASS_DEF_PRIVATE 1
275 #endif
277 /* Hide _MonoClass definition in checked build mode to ensure that
278 * it is only accessed via getter and setter methods.
280 #ifndef MONO_CLASS_DEF_PRIVATE
281 #include "class-private-definition.h"
282 #endif
284 /* If MonoClass definition is hidden, just declare the getters.
285 * Otherwise, define them as static inline functions.
287 #ifdef MONO_CLASS_DEF_PRIVATE
288 #define MONO_CLASS_GETTER(funcname, rettype, optref, argtype, fieldname) rettype funcname (argtype *klass);
289 #else
290 #define MONO_CLASS_GETTER(funcname, rettype, optref, argtype, fieldname) static inline rettype funcname (argtype *klass) { return optref klass-> fieldname ; }
291 #endif
292 #define MONO_CLASS_OFFSET(funcname, argtype, fieldname) /*nothing*/
293 #include "class-getters.h"
294 #undef MONO_CLASS_GETTER
295 #undef MONO_CLASS_OFFSET
297 #ifdef COMPRESSED_INTERFACE_BITMAP
298 int mono_compress_bitmap (uint8_t *dest, const uint8_t *bitmap, int size);
299 int mono_class_interface_match (const uint8_t *bitmap, int id);
300 #else
301 #define mono_class_interface_match(bmap,uiid) ((bmap) [(uiid) >> 3] & (1 << ((uiid)&7)))
302 #endif
304 #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)))
306 #define MONO_VTABLE_AVAILABLE_GC_BITS 4
308 #ifdef DISABLE_REMOTING
309 #define mono_class_is_marshalbyref(klass) (FALSE)
310 #define mono_class_is_contextbound(klass) (FALSE)
311 #define mono_vtable_is_remote(vtable) (FALSE)
312 #define mono_vtable_set_is_remote(vtable,enable) do {} while (0)
313 #else
314 #define mono_class_is_marshalbyref(klass) (m_class_get_marshalbyref (klass))
315 #define mono_class_is_contextbound(klass) (m_class_get_contextbound (klass))
316 #define mono_vtable_is_remote(vtable) ((vtable)->remote)
317 #define mono_vtable_set_is_remote(vtable,enable) do { (vtable)->remote = enable ? 1 : 0; } while (0)
318 #endif
320 #ifdef DISABLE_COM
321 #define mono_class_is_com_object(klass) (FALSE)
322 #else
323 #define mono_class_is_com_object(klass) (m_class_is_com_object (klass))
324 #endif
327 MONO_API int mono_class_interface_offset (MonoClass *klass, MonoClass *itf);
328 int mono_class_interface_offset_with_variance (MonoClass *klass, MonoClass *itf, gboolean *non_exact_match);
330 typedef gpointer MonoRuntimeGenericContext;
332 typedef enum {
333 /* array or string */
334 MONO_VT_FLAG_ARRAY_OR_STRING = (1 << 0)
335 } MonoVTableFlags;
337 /* the interface_offsets array is stored in memory before this struct */
338 struct MonoVTable {
339 MonoClass *klass;
341 * According to comments in gc_gcj.h, this should be the second word in
342 * the vtable.
344 MonoGCDescriptor gc_descr;
345 MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
346 gpointer type; /* System.Type type for klass */
347 guint8 *interface_bitmap;
348 guint32 max_interface_id;
349 guint8 rank;
350 /* Keep this a guint8, the jit depends on it */
351 guint8 initialized; /* cctor has been run */
352 /* Keep this a guint8, the jit depends on it */
353 guint8 flags; /* MonoVTableFlags */
354 guint remote : 1; /* class is remotely activated */
355 guint init_failed : 1; /* cctor execution failed */
356 guint has_static_fields : 1; /* pointer to the data stored at the end of the vtable array */
357 guint gc_bits : MONO_VTABLE_AVAILABLE_GC_BITS; /* Those bits are reserved for the usaged of the GC */
359 guint32 imt_collisions_bitmap;
360 MonoRuntimeGenericContext *runtime_generic_context;
361 /* interp virtual method table */
362 gpointer *interp_vtable;
363 /* do not add any fields after vtable, the structure is dynamically extended */
364 /* vtable contains function pointers to methods or their trampolines, at the
365 end there may be a slot containing the pointer to the static fields */
366 gpointer vtable [MONO_ZERO_LEN_ARRAY];
369 #define MONO_SIZEOF_VTABLE (sizeof (MonoVTable) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
371 #define MONO_VTABLE_IMPLEMENTS_INTERFACE(vt,uiid) (((uiid) <= (vt)->max_interface_id) && mono_class_interface_match ((vt)->interface_bitmap, (uiid)))
374 * Generic instantiation data type encoding.
378 * A particular generic instantiation:
380 * All instantiations are cached and we don't distinguish between class and method
381 * instantiations here.
383 struct _MonoGenericInst {
384 #ifndef MONO_SMALL_CONFIG
385 gint32 id; /* unique ID for debugging */
386 #endif
387 guint type_argc : 22; /* number of type arguments */
388 guint is_open : 1; /* if this is an open type */
389 MonoType *type_argv [MONO_ZERO_LEN_ARRAY];
392 #define MONO_SIZEOF_GENERIC_INST (sizeof (MonoGenericInst) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
394 * The generic context: an instantiation of a set of class and method generic parameters.
396 * NOTE: Never allocate this directly on the heap. It have to be either allocated on the stack,
397 * or embedded within other objects. Don't store pointers to this, because it may be on the stack.
398 * If you really have to, ensure you store a pointer to the embedding object along with it.
400 struct _MonoGenericContext {
401 /* The instantiation corresponding to the class generic parameters */
402 MonoGenericInst *class_inst;
403 /* The instantiation corresponding to the method generic parameters */
404 MonoGenericInst *method_inst;
408 * Inflated generic method.
410 struct _MonoMethodInflated {
411 union {
412 MonoMethod method;
413 MonoMethodPInvoke pinvoke;
414 } method;
415 MonoMethod *declaring; /* the generic method definition. */
416 MonoGenericContext context; /* The current instantiation */
417 MonoImageSet *owner; /* The image set that the inflated method belongs to. */
421 * A particular instantiation of a generic type.
423 struct _MonoGenericClass {
424 MonoClass *container_class; /* the generic type definition */
425 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 */
426 guint is_dynamic : 1; /* Contains dynamic types */
427 guint is_tb_open : 1; /* This is the fully open instantiation for a type_builder. Quite ugly, but it's temporary.*/
428 guint need_sync : 1; /* Only if dynamic. Need to be synchronized with its container class after its finished. */
429 MonoClass *cached_class; /* if present, the MonoClass corresponding to the instantiation. */
432 * The image set which owns this generic class. Memory owned by the generic class
433 * including cached_class should be allocated from the mempool of the image set,
434 * so it is easy to free.
436 MonoImageSet *owner;
439 /* Additional details about a MonoGenericParam */
440 /* Keep in sync with managed Mono.RuntimeStructs.GenericParamInfo */
441 typedef struct {
442 MonoClass *pklass; /* The corresponding `MonoClass'. */
443 const char *name;
445 // See GenericParameterAttributes
446 guint16 flags;
448 guint32 token;
450 // Constraints on type parameters
451 MonoClass** constraints; /* NULL means end of list */
452 } MonoGenericParamInfo;
455 * A type parameter.
457 struct _MonoGenericParam {
459 * Type or method this parameter was defined in.
461 MonoGenericContainer *owner;
462 guint16 num;
464 * If != NULL, this is a generated generic param used by the JIT to implement generic
465 * sharing.
467 MonoType *gshared_constraint;
469 MonoGenericParamInfo info;
472 typedef MonoGenericParam MonoGenericParamFull;
475 * The generic container.
477 * Stores the type parameters of a generic type definition or a generic method definition.
479 struct _MonoGenericContainer {
480 MonoGenericContext context;
481 /* If we're a generic method definition in a generic type definition,
482 the generic container of the containing class. */
483 MonoGenericContainer *parent;
484 /* the generic type definition or the generic method definition corresponding to this container */
485 /* Union rules: If is_anonymous, image field is valid; else if is_method, method field is valid; else klass is valid. */
486 union {
487 MonoClass *klass;
488 MonoMethod *method;
489 MonoImage *image;
490 } owner;
491 int type_argc : 29; // Per the ECMA spec, this value is capped at 16 bits
492 /* If true, we're a generic method, otherwise a generic type definition. */
493 /* Invariant: parent != NULL => is_method */
494 int is_method : 1;
495 /* If true, this container has no associated class/method and only the image is known. This can happen:
496 1. For the special anonymous containers kept by MonoImage.
497 2. When user code creates a generic parameter via SRE, but has not yet set an owner. */
498 int is_anonymous : 1;
499 /* Our type parameters. If this is a special anonymous container (case 1, above), this field is not valid, use mono_metadata_create_anon_gparam () */
500 MonoGenericParamFull *type_params;
503 static inline MonoGenericParam *
504 mono_generic_container_get_param (MonoGenericContainer *gc, int i)
506 return (MonoGenericParam *) &gc->type_params [i];
509 static inline MonoGenericParamInfo *
510 mono_generic_container_get_param_info (MonoGenericContainer *gc, int i)
512 return &gc->type_params [i].info;
515 static inline MonoGenericContainer *
516 mono_generic_param_owner (MonoGenericParam *p)
518 return p->owner;
521 static inline int
522 mono_generic_param_num (MonoGenericParam *p)
524 return p->num;
527 static inline MonoGenericParamInfo *
528 mono_generic_param_info (MonoGenericParam *p)
530 return &((MonoGenericParamFull *) p)->info;
533 static inline const char *
534 mono_generic_param_name (MonoGenericParam *p)
536 return ((MonoGenericParamFull *) p)->info.name;
539 static inline MonoGenericContainer *
540 mono_type_get_generic_param_owner (MonoType *t)
542 return mono_generic_param_owner (t->data.generic_param);
545 static inline int
546 mono_type_get_generic_param_num (MonoType *t)
548 return mono_generic_param_num (t->data.generic_param);
552 * Class information which might be cached by the runtime in the AOT file for
553 * example. Caching this allows us to avoid computing a generic vtable
554 * (class->vtable) in most cases, saving time and avoiding creation of lots of
555 * MonoMethod structures.
557 typedef struct MonoCachedClassInfo {
558 guint32 vtable_size;
559 guint has_finalize : 1;
560 guint ghcimpl : 1;
561 guint has_cctor : 1;
562 guint has_nested_classes : 1;
563 guint blittable : 1;
564 guint has_references : 1;
565 guint has_static_refs : 1;
566 guint no_special_static_fields : 1;
567 guint is_generic_container : 1;
568 guint has_weak_fields : 1;
569 guint32 cctor_token;
570 MonoImage *finalize_image;
571 guint32 finalize_token;
572 guint32 instance_size;
573 guint32 class_size;
574 guint32 packing_size;
575 guint32 min_align;
576 } MonoCachedClassInfo;
578 typedef struct {
579 // Name and func fields double as "inited".
580 // That is, any initialized MonoJitICallInfo must
581 // have both of them to be non-NULL.
582 const char *name;
583 gconstpointer func;
584 gconstpointer wrapper;
585 gconstpointer trampoline;
586 MonoMethodSignature *sig;
587 const char *c_symbol;
588 MonoMethod *wrapper_method;
589 } MonoJitICallInfo;
591 void
592 mono_class_setup_supertypes (MonoClass *klass);
594 /* WARNING
595 * Only call this function if you can ensure both @klass and @parent
596 * have supertype information initialized.
597 * This can be accomplished by mono_class_setup_supertypes or mono_class_init.
598 * If unsure, use mono_class_has_parent.
600 static inline gboolean
601 mono_class_has_parent_fast (MonoClass *klass, MonoClass *parent)
603 return (m_class_get_idepth (klass) >= m_class_get_idepth (parent)) && (m_class_get_supertypes (klass) [m_class_get_idepth (parent) - 1] == parent);
606 static inline gboolean
607 mono_class_has_parent (MonoClass *klass, MonoClass *parent)
609 if (G_UNLIKELY (!m_class_get_supertypes (klass)))
610 mono_class_setup_supertypes (klass);
612 if (G_UNLIKELY (!m_class_get_supertypes (parent)))
613 mono_class_setup_supertypes (parent);
615 return mono_class_has_parent_fast (klass, parent);
618 typedef struct {
619 MonoVTable *default_vtable;
620 MonoVTable *xdomain_vtable;
621 MonoClass *proxy_class;
622 char* proxy_class_name;
623 uint32_t interface_count;
624 MonoClass *interfaces [MONO_ZERO_LEN_ARRAY];
625 } MonoRemoteClass;
627 #define MONO_SIZEOF_REMOTE_CLASS (sizeof (MonoRemoteClass) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
629 typedef struct {
630 gint32 initialized_class_count;
631 gint32 generic_vtable_count;
632 gint32 used_class_count;
633 gint32 method_count;
634 gint32 class_vtable_size;
635 gint32 class_static_data_size;
636 gint32 generic_class_count;
637 gint32 inflated_method_count;
638 gint32 inflated_type_count;
639 gint32 delegate_creations;
640 gint32 imt_tables_size;
641 gint32 imt_number_of_tables;
642 gint32 imt_number_of_methods;
643 gint32 imt_used_slots;
644 gint32 imt_slots_with_collisions;
645 gint32 imt_max_collisions_in_slot;
646 gint32 imt_method_count_when_max_collisions;
647 gint32 imt_trampolines_size;
648 gint32 jit_info_table_insert_count;
649 gint32 jit_info_table_remove_count;
650 gint32 jit_info_table_lookup_count;
651 gint32 generics_sharable_methods;
652 gint32 generics_unsharable_methods;
653 gint32 generics_shared_methods;
654 gint32 gsharedvt_methods;
655 gboolean enabled;
656 } MonoStats;
659 * new structure to hold performace counters values that are exported
660 * to managed code.
661 * Note: never remove fields from this structure and only add them to the end.
662 * Size of fields and type should not be changed as well.
664 typedef struct {
665 /* JIT category */
666 gint32 jit_methods;
667 gint32 jit_bytes;
668 gint32 jit_time;
669 gint32 jit_failures;
670 /* Exceptions category */
671 gint32 exceptions_thrown;
672 gint32 exceptions_filters;
673 gint32 exceptions_finallys;
674 gint32 exceptions_depth;
675 gint32 aspnet_requests_queued;
676 gint32 aspnet_requests;
677 /* Memory category */
678 gint32 gc_collections0;
679 gint32 gc_collections1;
680 gint32 gc_collections2;
681 gint32 gc_promotions0;
682 gint32 gc_promotions1;
683 gint32 gc_promotion_finalizers;
684 gint64 gc_gen0size;
685 gint64 gc_gen1size;
686 gint64 gc_gen2size;
687 gint32 gc_lossize;
688 gint32 gc_fin_survivors;
689 gint32 gc_num_handles;
690 gint32 gc_allocated;
691 gint32 gc_induced;
692 gint32 gc_time;
693 gint64 gc_total_bytes;
694 gint64 gc_committed_bytes;
695 gint64 gc_reserved_bytes;
696 gint32 gc_num_pinned;
697 gint32 gc_sync_blocks;
698 /* Remoting category */
699 gint32 remoting_calls;
700 gint32 remoting_channels;
701 gint32 remoting_proxies;
702 gint32 remoting_classes;
703 gint32 remoting_objects;
704 gint32 remoting_contexts;
705 /* Loader category */
706 gint32 loader_classes;
707 gint32 loader_total_classes;
708 gint32 loader_appdomains;
709 gint32 loader_total_appdomains;
710 gint32 loader_assemblies;
711 gint32 loader_total_assemblies;
712 gint32 loader_failures;
713 gint32 loader_bytes;
714 gint32 loader_appdomains_uloaded;
715 /* Threads and Locks category */
716 gint32 thread_contentions;
717 gint32 thread_queue_len;
718 gint32 thread_queue_max;
719 gint32 thread_num_logical;
720 gint32 thread_num_physical;
721 gint32 thread_cur_recognized;
722 gint32 thread_num_recognized;
723 /* Interop category */
724 gint32 interop_num_ccw;
725 gint32 interop_num_stubs;
726 gint32 interop_num_marshals;
727 /* Security category */
728 gint32 security_num_checks;
729 gint32 security_num_link_checks;
730 gint32 security_time;
731 gint32 security_depth;
732 gint32 unused;
733 /* Threadpool */
734 gint32 threadpool_threads;
735 gint64 threadpool_workitems;
736 gint64 threadpool_ioworkitems;
737 gint32 threadpool_iothreads;
738 } MonoPerfCounters;
740 extern MonoPerfCounters *mono_perfcounters;
742 MONO_API void mono_perfcounters_init (void);
745 * The definition of the first field in SafeHandle,
746 * Keep in sync with SafeHandle.cs, this is only used
747 * to access the `handle' parameter.
749 typedef struct {
750 MonoObject base;
751 void *handle;
752 } MonoSafeHandle;
755 * Keep in sync with HandleRef.cs
757 typedef struct {
758 MonoObject *wrapper;
759 void *handle;
760 } MonoHandleRef;
762 extern MonoStats mono_stats;
764 typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
766 typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
768 static inline gboolean
769 method_is_dynamic (MonoMethod *method)
771 #ifdef DISABLE_REFLECTION_EMIT
772 return FALSE;
773 #else
774 return method->dynamic;
775 #endif
778 MonoMethod*
779 mono_class_get_method_by_index (MonoClass *klass, int index);
781 MonoMethod*
782 mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method, MonoError *error);
784 MonoMethod*
785 mono_class_get_vtable_entry (MonoClass *klass, int offset);
787 GPtrArray*
788 mono_class_get_implemented_interfaces (MonoClass *klass, MonoError *error);
791 mono_class_get_vtable_size (MonoClass *klass);
793 gboolean
794 mono_class_is_open_constructed_type (MonoType *t);
796 void
797 mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides, MonoGenericContext *generic_context, MonoError *error);
799 MonoMethod*
800 mono_class_get_cctor (MonoClass *klass) MONO_LLVM_INTERNAL;
802 MonoMethod*
803 mono_class_get_finalizer (MonoClass *klass);
805 gboolean
806 mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller);
808 gboolean
809 mono_class_field_is_special_static (MonoClassField *field);
811 guint32
812 mono_class_field_get_special_static_type (MonoClassField *field);
814 gboolean
815 mono_class_has_special_static_fields (MonoClass *klass);
817 const char*
818 mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_type);
820 MonoProperty*
821 mono_class_get_property_from_name_internal (MonoClass *klass, const char *name);
823 const char*
824 mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def_type);
826 gpointer
827 mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error);
829 gpointer
830 mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, gboolean check_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
832 gpointer
833 mono_runtime_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper, MonoError *error);
835 gpointer
836 mono_runtime_create_delegate_trampoline (MonoClass *klass);
838 void
839 mono_install_get_cached_class_info (MonoGetCachedClassInfo func);
841 void
842 mono_install_get_class_from_name (MonoGetClassFromName func);
844 MONO_PROFILER_API MonoGenericContext*
845 mono_class_get_context (MonoClass *klass);
847 MONO_PROFILER_API MonoMethodSignature*
848 mono_method_signature_checked (MonoMethod *m, MonoError *err);
850 MONO_PROFILER_API MonoMethodSignature*
851 mono_method_signature_internal (MonoMethod *m);
853 MonoGenericContext*
854 mono_method_get_context_general (MonoMethod *method, gboolean uninflated);
856 MONO_PROFILER_API MonoGenericContext*
857 mono_method_get_context (MonoMethod *method);
859 /* Used by monodis, thus cannot be MONO_INTERNAL */
860 MONO_API MonoGenericContainer*
861 mono_method_get_generic_container (MonoMethod *method);
863 MonoGenericContext*
864 mono_generic_class_get_context (MonoGenericClass *gclass);
866 void
867 mono_method_set_generic_container (MonoMethod *method, MonoGenericContainer* container);
869 MonoMethod*
870 mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context, MonoError *error);
872 MonoMethod *
873 mono_class_inflate_generic_method_checked (MonoMethod *method, MonoGenericContext *context, MonoError *error);
875 MonoImageSet *
876 mono_metadata_get_image_set_for_class (MonoClass *klass);
878 MonoImageSet *
879 mono_metadata_get_image_set_for_method (MonoMethodInflated *method);
881 MONO_API MonoMethodSignature *
882 mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericContext *context);
884 MonoType*
885 mono_class_inflate_generic_type_with_mempool (MonoImage *image, MonoType *type, MonoGenericContext *context, MonoError *error);
887 MonoType*
888 mono_class_inflate_generic_type_checked (MonoType *type, MonoGenericContext *context, MonoError *error);
890 MONO_API void
891 mono_metadata_free_inflated_signature (MonoMethodSignature *sig);
893 MonoMethodSignature*
894 mono_inflate_generic_signature (MonoMethodSignature *sig, MonoGenericContext *context, MonoError *error);
896 MonoClass*
897 mono_generic_param_get_base_type (MonoClass *klass);
899 typedef struct {
900 MonoImage *corlib;
901 MonoClass *object_class;
902 MonoClass *byte_class;
903 MonoClass *void_class;
904 MonoClass *boolean_class;
905 MonoClass *sbyte_class;
906 MonoClass *int16_class;
907 MonoClass *uint16_class;
908 MonoClass *int32_class;
909 MonoClass *uint32_class;
910 MonoClass *int_class;
911 MonoClass *uint_class;
912 MonoClass *int64_class;
913 MonoClass *uint64_class;
914 MonoClass *single_class;
915 MonoClass *double_class;
916 MonoClass *char_class;
917 MonoClass *string_class;
918 MonoClass *enum_class;
919 MonoClass *array_class;
920 MonoClass *delegate_class;
921 MonoClass *multicastdelegate_class;
922 MonoClass *manualresetevent_class;
923 MonoClass *typehandle_class;
924 MonoClass *fieldhandle_class;
925 MonoClass *methodhandle_class;
926 MonoClass *systemtype_class;
927 MonoClass *runtimetype_class;
928 MonoClass *exception_class;
929 MonoClass *threadabortexception_class;
930 MonoClass *thread_class;
931 MonoClass *internal_thread_class;
932 #ifndef DISABLE_REMOTING
933 MonoClass *transparent_proxy_class;
934 MonoClass *real_proxy_class;
935 MonoClass *marshalbyrefobject_class;
936 MonoClass *iremotingtypeinfo_class;
937 #endif
938 MonoClass *mono_method_message_class;
939 MonoClass *appdomain_class;
940 MonoClass *field_info_class;
941 MonoClass *method_info_class;
942 MonoClass *stack_frame_class;
943 MonoClass *marshal_class;
944 MonoClass *typed_reference_class;
945 MonoClass *argumenthandle_class;
946 MonoClass *monitor_class;
947 MonoClass *generic_ilist_class;
948 MonoClass *generic_nullable_class;
949 MonoClass *attribute_class;
950 MonoClass *critical_finalizer_object; /* MAYBE NULL */
951 MonoClass *generic_ireadonlylist_class;
952 MonoClass *generic_ienumerator_class;
953 MonoMethod *threadpool_perform_wait_callback_method;
954 } MonoDefaults;
956 #ifdef DISABLE_REMOTING
957 #define mono_class_is_transparent_proxy(klass) (FALSE)
958 #define mono_class_is_real_proxy(klass) (FALSE)
959 #else
960 #define mono_class_is_transparent_proxy(klass) ((klass) == mono_defaults.transparent_proxy_class)
961 #define mono_class_is_real_proxy(klass) ((klass) == mono_defaults.real_proxy_class)
962 #endif
964 #define mono_object_is_transparent_proxy(object) (mono_class_is_transparent_proxy (mono_object_class (object)))
967 #define GENERATE_GET_CLASS_WITH_CACHE_DECL(shortname) \
968 MonoClass* mono_class_get_##shortname##_class (void);
970 #define GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(shortname) \
971 MonoClass* mono_class_try_get_##shortname##_class (void);
973 #define GENERATE_GET_CLASS_WITH_CACHE(shortname,name_space,name) \
974 MonoClass* \
975 mono_class_get_##shortname##_class (void) \
977 static MonoClass *tmp_class; \
978 MonoClass *klass = tmp_class; \
979 if (!klass) { \
980 klass = mono_class_load_from_name (mono_defaults.corlib, name_space, name); \
981 mono_memory_barrier (); \
982 tmp_class = klass; \
984 return klass; \
987 #define GENERATE_TRY_GET_CLASS_WITH_CACHE(shortname,name_space,name) \
988 MonoClass* \
989 mono_class_try_get_##shortname##_class (void) \
991 static volatile MonoClass *tmp_class; \
992 static volatile gboolean inited; \
993 MonoClass *klass = (MonoClass *)tmp_class; \
994 mono_memory_barrier (); \
995 if (!inited) { \
996 klass = mono_class_try_load_from_name (mono_defaults.corlib, name_space, name); \
997 tmp_class = klass; \
998 mono_memory_barrier (); \
999 inited = TRUE; \
1001 return klass; \
1004 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (safehandle)
1006 #ifndef DISABLE_COM
1008 GENERATE_GET_CLASS_WITH_CACHE_DECL (interop_proxy)
1009 GENERATE_GET_CLASS_WITH_CACHE_DECL (idispatch)
1010 GENERATE_GET_CLASS_WITH_CACHE_DECL (iunknown)
1011 GENERATE_GET_CLASS_WITH_CACHE_DECL (com_object)
1012 GENERATE_GET_CLASS_WITH_CACHE_DECL (variant)
1014 #endif
1016 GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain)
1017 GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain_setup)
1019 GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain_unloaded_exception)
1020 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (appdomain_unloaded_exception)
1022 GENERATE_GET_CLASS_WITH_CACHE_DECL (valuetype)
1024 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(handleref)
1025 /* If you need a MonoType, use one of the mono_get_*_type () functions in class-inlines.h */
1026 extern MonoDefaults mono_defaults;
1028 void
1029 mono_loader_init (void);
1031 void
1032 mono_loader_cleanup (void);
1034 void
1035 mono_loader_lock (void) MONO_LLVM_INTERNAL;
1037 void
1038 mono_loader_unlock (void) MONO_LLVM_INTERNAL;
1040 void
1041 mono_loader_lock_track_ownership (gboolean track);
1043 gboolean
1044 mono_loader_lock_is_owned_by_self (void);
1046 void
1047 mono_loader_lock_if_inited (void);
1049 void
1050 mono_loader_unlock_if_inited (void);
1052 void
1053 mono_reflection_init (void);
1055 void
1056 mono_icall_init (void);
1058 void
1059 mono_icall_cleanup (void);
1061 gpointer
1062 mono_method_get_wrapper_data (MonoMethod *method, guint32 id);
1064 gboolean
1065 mono_metadata_has_generic_params (MonoImage *image, guint32 token);
1067 MONO_API MonoGenericContainer *
1068 mono_metadata_load_generic_params (MonoImage *image, guint32 token,
1069 MonoGenericContainer *parent_container,
1070 gpointer real_owner);
1072 MONO_API gboolean
1073 mono_metadata_load_generic_param_constraints_checked (MonoImage *image, guint32 token,
1074 MonoGenericContainer *container, MonoError *error);
1076 // This is the "real" function for registering JIT icalls. All others are one line wrappers that call it,
1077 // i.e. filling in info or c_symbol.
1078 void
1079 mono_register_jit_icall_info (MonoJitICallInfo *info, gconstpointer func, const char *name,
1080 MonoMethodSignature *sig, gboolean no_wrapper, const char *c_symbol);
1082 #ifdef __cplusplus
1083 template <typename T>
1084 inline void
1085 mono_register_jit_icall_info (MonoJitICallInfo *info, T func, const char *name, MonoMethodSignature *sig, gboolean no_wrapper, const char *c_symbol)
1087 mono_register_jit_icall_info (info, (gconstpointer)func, name, sig, no_wrapper, c_symbol);
1089 #endif // __cplusplus
1091 #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))
1093 void
1094 mono_register_jit_icall_wrapper (MonoJitICallInfo *info, gconstpointer wrapper);
1096 MonoJitICallInfo *
1097 mono_find_jit_icall_by_name (const char *name) MONO_LLVM_INTERNAL;
1099 MonoJitICallInfo *
1100 mono_find_jit_icall_by_addr (gconstpointer addr) MONO_LLVM_INTERNAL;
1102 const char*
1103 mono_lookup_jit_icall_symbol (const char *name);
1105 gboolean
1106 mono_class_set_type_load_failure (MonoClass *klass, const char * fmt, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
1108 MonoException*
1109 mono_class_get_exception_for_failure (MonoClass *klass);
1111 char*
1112 mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
1114 char*
1115 mono_type_get_full_name (MonoClass *klass);
1117 char *
1118 mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret, MonoTypeNameFormat format);
1120 MONO_PROFILER_API char *
1121 mono_method_get_full_name (MonoMethod *method);
1123 const char*
1124 mono_wrapper_type_to_str (guint32 wrapper_type);
1126 MonoArrayType *mono_dup_array_type (MonoImage *image, MonoArrayType *a);
1127 MonoMethodSignature *mono_metadata_signature_deep_dup (MonoImage *image, MonoMethodSignature *sig);
1129 MONO_API void
1130 mono_image_init_name_cache (MonoImage *image);
1132 MonoClass*
1133 mono_class_get_nullable_param_internal (MonoClass *klass);
1135 /* object debugging functions, for use inside gdb */
1136 MONO_API void mono_object_describe (MonoObject *obj);
1137 MONO_API void mono_object_describe_fields (MonoObject *obj);
1138 MONO_API void mono_value_describe_fields (MonoClass* klass, const char* addr);
1139 MONO_API void mono_class_describe_statics (MonoClass* klass);
1141 /* method debugging functions, for use inside gdb */
1142 MONO_API void mono_method_print_code (MonoMethod *method);
1144 MONO_PROFILER_API char *mono_signature_full_name (MonoMethodSignature *sig);
1146 /*Enum validation related functions*/
1147 MONO_API gboolean
1148 mono_type_is_valid_enum_basetype (MonoType * type);
1150 MONO_API gboolean
1151 mono_class_is_valid_enum (MonoClass *klass);
1153 MONO_PROFILER_API gboolean
1154 mono_type_is_primitive (MonoType *type);
1156 MonoType *
1157 mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
1159 gboolean
1160 mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass);
1162 MonoType*
1163 mono_type_get_basic_type_from_generic (MonoType *type);
1165 gboolean
1166 mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, MonoClass *context_klass);
1168 gboolean
1169 mono_method_can_access_field_full (MonoMethod *method, MonoClassField *field, MonoClass *context_klass);
1171 gboolean
1172 mono_class_can_access_class (MonoClass *access_class, MonoClass *target_class);
1174 MonoClass *
1175 mono_class_get_generic_type_definition (MonoClass *klass);
1177 gboolean
1178 mono_class_has_parent_and_ignore_generics (MonoClass *klass, MonoClass *parent);
1181 mono_method_get_vtable_slot (MonoMethod *method);
1184 mono_method_get_vtable_index (MonoMethod *method);
1186 MonoMethod*
1187 mono_method_get_base_method (MonoMethod *method, gboolean definition, MonoError *error);
1189 MonoMethod*
1190 mono_method_search_in_array_class (MonoClass *klass, const char *name, MonoMethodSignature *sig);
1192 void
1193 mono_class_setup_interface_id (MonoClass *klass);
1195 MonoGenericContainer*
1196 mono_class_get_generic_container (MonoClass *klass);
1198 gpointer
1199 mono_class_alloc (MonoClass *klass, int size);
1201 gpointer
1202 mono_class_alloc0 (MonoClass *klass, int size);
1204 #define mono_class_alloc0(klass, size) (g_cast (mono_class_alloc0 ((klass), (size))))
1206 void
1207 mono_class_setup_interfaces (MonoClass *klass, MonoError *error);
1209 MonoClassField*
1210 mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoType *type);
1212 MonoVTable*
1213 mono_class_vtable_checked (MonoDomain *domain, MonoClass *klass, MonoError *error);
1215 void
1216 mono_class_is_assignable_from_checked (MonoClass *klass, MonoClass *oklass, gboolean *result, MonoError *error);
1218 gboolean
1219 mono_class_is_assignable_from_slow (MonoClass *target, MonoClass *candidate);
1221 gboolean
1222 mono_class_has_variant_generic_params (MonoClass *klass);
1224 gboolean
1225 mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass, gboolean check_for_reference_conv);
1227 gboolean
1228 mono_class_is_subclass_of_internal (MonoClass *klass, MonoClass *klassc, gboolean check_interfaces);
1230 mono_bool
1231 mono_class_is_assignable_from_internal (MonoClass *klass, MonoClass *oklass);
1233 gboolean mono_is_corlib_image (MonoImage *image);
1235 MonoType*
1236 mono_field_get_type_checked (MonoClassField *field, MonoError *error);
1238 MonoType*
1239 mono_field_get_type_internal (MonoClassField *field);
1241 MonoClassField*
1242 mono_class_get_fields_internal (MonoClass* klass, gpointer *iter);
1244 MonoClassField*
1245 mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter);
1247 gboolean
1248 mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup);
1250 gboolean
1251 mono_class_has_finalizer (MonoClass *klass);
1253 void
1254 mono_unload_interface_id (MonoClass *klass);
1256 GPtrArray*
1257 mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, guint32 mlisttype, gboolean allow_ctors, MonoError *error);
1259 char*
1260 mono_class_full_name (MonoClass *klass);
1262 MonoClass*
1263 mono_class_inflate_generic_class_checked (MonoClass *gklass, MonoGenericContext *context, MonoError *error);
1265 MONO_PROFILER_API MonoClass *
1266 mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error);
1268 MonoClass *
1269 mono_class_get_and_inflate_typespec_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
1271 MonoClass *
1272 mono_class_from_name_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error);
1274 MonoClass *
1275 mono_class_from_name_case_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error);
1277 MONO_PROFILER_API MonoClass *
1278 mono_class_from_mono_type_internal (MonoType *type);
1280 MonoClassField*
1281 mono_field_from_token_checked (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context, MonoError *error);
1283 gpointer
1284 mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
1286 MonoImage *
1287 mono_get_image_for_generic_param (MonoGenericParam *param);
1289 char *
1290 mono_make_generic_name_string (MonoImage *image, int num);
1292 MonoClass *
1293 mono_class_load_from_name (MonoImage *image, const char* name_space, const char *name) MONO_LLVM_INTERNAL;
1295 MonoClass*
1296 mono_class_try_load_from_name (MonoImage *image, const char* name_space, const char *name);
1298 void
1299 mono_error_set_for_class_failure (MonoError *orerror, const MonoClass *klass);
1301 gboolean
1302 mono_class_has_failure (const MonoClass *klass);
1304 /* Kind specific accessors */
1305 MonoGenericClass*
1306 mono_class_get_generic_class (MonoClass *klass) MONO_LLVM_INTERNAL;
1308 MonoGenericClass*
1309 mono_class_try_get_generic_class (MonoClass *klass);
1311 void
1312 mono_class_set_flags (MonoClass *klass, guint32 flags);
1314 MonoGenericContainer*
1315 mono_class_try_get_generic_container (MonoClass *klass);
1317 void
1318 mono_class_set_generic_container (MonoClass *klass, MonoGenericContainer *container);
1320 MonoType*
1321 mono_class_gtd_get_canonical_inst (MonoClass *klass);
1323 guint32
1324 mono_class_get_first_method_idx (MonoClass *klass);
1326 void
1327 mono_class_set_first_method_idx (MonoClass *klass, guint32 idx);
1329 guint32
1330 mono_class_get_first_field_idx (MonoClass *klass);
1332 void
1333 mono_class_set_first_field_idx (MonoClass *klass, guint32 idx);
1335 guint32
1336 mono_class_get_method_count (MonoClass *klass);
1338 void
1339 mono_class_set_method_count (MonoClass *klass, guint32 count);
1341 guint32
1342 mono_class_get_field_count (MonoClass *klass);
1344 void
1345 mono_class_set_field_count (MonoClass *klass, guint32 count);
1347 MonoMarshalType*
1348 mono_class_get_marshal_info (MonoClass *klass);
1350 void
1351 mono_class_set_marshal_info (MonoClass *klass, MonoMarshalType *marshal_info);
1353 guint32
1354 mono_class_get_ref_info_handle (MonoClass *klass);
1356 guint32
1357 mono_class_set_ref_info_handle (MonoClass *klass, guint32 value);
1359 MonoErrorBoxed*
1360 mono_class_get_exception_data (MonoClass *klass);
1362 void
1363 mono_class_set_exception_data (MonoClass *klass, MonoErrorBoxed *value);
1365 GList*
1366 mono_class_get_nested_classes_property (MonoClass *klass);
1368 void
1369 mono_class_set_nested_classes_property (MonoClass *klass, GList *value);
1371 MonoClassPropertyInfo*
1372 mono_class_get_property_info (MonoClass *klass);
1374 void
1375 mono_class_set_property_info (MonoClass *klass, MonoClassPropertyInfo *info);
1377 MonoClassEventInfo*
1378 mono_class_get_event_info (MonoClass *klass);
1380 void
1381 mono_class_set_event_info (MonoClass *klass, MonoClassEventInfo *info);
1383 MonoFieldDefaultValue*
1384 mono_class_get_field_def_values (MonoClass *klass);
1386 void
1387 mono_class_set_field_def_values (MonoClass *klass, MonoFieldDefaultValue *values);
1389 guint32
1390 mono_class_get_declsec_flags (MonoClass *klass);
1392 void
1393 mono_class_set_declsec_flags (MonoClass *klass, guint32 value);
1395 void
1396 mono_class_set_is_com_object (MonoClass *klass);
1398 void
1399 mono_class_set_weak_bitmap (MonoClass *klass, int nbits, gsize *bits);
1401 gsize*
1402 mono_class_get_weak_bitmap (MonoClass *klass, int *nbits);
1404 gboolean
1405 mono_class_has_dim_conflicts (MonoClass *klass);
1407 void
1408 mono_class_set_dim_conflicts (MonoClass *klass, GSList *conflicts);
1410 GSList*
1411 mono_class_get_dim_conflicts (MonoClass *klass);
1413 MonoMethod *
1414 mono_class_get_method_from_name_checked (MonoClass *klass, const char *name, int param_count, int flags, MonoError *error);
1416 gboolean
1417 mono_method_has_no_body (MonoMethod *method);
1419 // FIXME Replace all internal callers of mono_method_get_header_checked with
1420 // mono_method_get_header_internal; the difference is in error initialization.
1422 // And then mark mono_method_get_header_checked as MONO_RT_EXTERNAL_ONLY MONO_API.
1424 // Internal callers expected to use ERROR_DECL. External callers are not.
1425 MonoMethodHeader*
1426 mono_method_get_header_internal (MonoMethod *method, MonoError *error);
1428 MonoType*
1429 mono_class_find_enum_basetype (MonoClass *klass, MonoError *error);
1431 gboolean
1432 mono_class_set_failure (MonoClass *klass, MonoErrorBoxed *boxed_error);
1434 gboolean
1435 mono_class_set_type_load_failure_causedby_class (MonoClass *klass, const MonoClass *caused_by, const gchar* msg);
1437 gboolean mono_class_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res);
1439 MonoMethod* mono_find_method_in_metadata (MonoClass *klass, const char *name, int param_count, int flags);
1442 mono_class_get_object_finalize_slot (void);
1444 MonoMethod *
1445 mono_class_get_default_finalize_method (void);
1447 void
1448 mono_field_resolve_type (MonoClassField *field, MonoError *error);
1450 gboolean
1451 mono_type_has_exceptions (MonoType *type);
1453 void
1454 mono_class_set_nonblittable (MonoClass *klass);
1456 gboolean
1457 mono_class_publish_gc_descriptor (MonoClass *klass, MonoGCDescriptor gc_descr);
1459 void
1460 mono_class_compute_gc_descriptor (MonoClass *klass);
1462 #ifndef DISABLE_REMOTING
1463 void
1464 mono_class_contextbound_bit_offset (int* byte_offset_out, guint8* mask_out);
1465 #endif
1467 gboolean
1468 mono_class_init_checked (MonoClass *klass, MonoError *error);
1470 MonoType*
1471 mono_class_enum_basetype_internal (MonoClass *klass) MONO_LLVM_INTERNAL;
1473 // Enum and static storage for JIT icalls.
1474 #include "jit-icall-reg.h"
1476 /*Now that everything has been defined, let's include the inline functions */
1477 #include <mono/metadata/class-inlines.h>
1479 #endif /* __MONO_METADATA_CLASS_INTERNALS_H__ */