Reduce TLS accesses. (#11487)
[mono-project.git] / mono / metadata / class-internals.h
blob2464cba10ae6aff2850d644b164f1a0439487a2a
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 /* the interface_offsets array is stored in memory before this struct */
333 struct MonoVTable {
334 MonoClass *klass;
336 * According to comments in gc_gcj.h, this should be the second word in
337 * the vtable.
339 MonoGCDescriptor gc_descr;
340 MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
341 gpointer type; /* System.Type type for klass */
342 guint8 *interface_bitmap;
343 guint32 max_interface_id;
344 guint8 rank;
345 /* Keep this a guint8, the jit depends on it */
346 guint8 initialized; /* cctor has been run */
347 guint remote : 1; /* class is remotely activated */
348 guint init_failed : 1; /* cctor execution failed */
349 guint has_static_fields : 1; /* pointer to the data stored at the end of the vtable array */
350 guint gc_bits : MONO_VTABLE_AVAILABLE_GC_BITS; /* Those bits are reserved for the usaged of the GC */
352 guint32 imt_collisions_bitmap;
353 MonoRuntimeGenericContext *runtime_generic_context;
354 /* do not add any fields after vtable, the structure is dynamically extended */
355 /* vtable contains function pointers to methods or their trampolines, at the
356 end there may be a slot containing the pointer to the static fields */
357 gpointer vtable [MONO_ZERO_LEN_ARRAY];
360 #define MONO_SIZEOF_VTABLE (sizeof (MonoVTable) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
362 #define MONO_VTABLE_IMPLEMENTS_INTERFACE(vt,uiid) (((uiid) <= (vt)->max_interface_id) && mono_class_interface_match ((vt)->interface_bitmap, (uiid)))
365 * Generic instantiation data type encoding.
369 * A particular generic instantiation:
371 * All instantiations are cached and we don't distinguish between class and method
372 * instantiations here.
374 struct _MonoGenericInst {
375 #ifndef MONO_SMALL_CONFIG
376 gint32 id; /* unique ID for debugging */
377 #endif
378 guint type_argc : 22; /* number of type arguments */
379 guint is_open : 1; /* if this is an open type */
380 MonoType *type_argv [MONO_ZERO_LEN_ARRAY];
383 #define MONO_SIZEOF_GENERIC_INST (sizeof (MonoGenericInst) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
385 * The generic context: an instantiation of a set of class and method generic parameters.
387 * NOTE: Never allocate this directly on the heap. It have to be either allocated on the stack,
388 * or embedded within other objects. Don't store pointers to this, because it may be on the stack.
389 * If you really have to, ensure you store a pointer to the embedding object along with it.
391 struct _MonoGenericContext {
392 /* The instantiation corresponding to the class generic parameters */
393 MonoGenericInst *class_inst;
394 /* The instantiation corresponding to the method generic parameters */
395 MonoGenericInst *method_inst;
399 * Inflated generic method.
401 struct _MonoMethodInflated {
402 union {
403 MonoMethod method;
404 MonoMethodPInvoke pinvoke;
405 } method;
406 MonoMethod *declaring; /* the generic method definition. */
407 MonoGenericContext context; /* The current instantiation */
408 MonoImageSet *owner; /* The image set that the inflated method belongs to. */
412 * A particular instantiation of a generic type.
414 struct _MonoGenericClass {
415 MonoClass *container_class; /* the generic type definition */
416 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 */
417 guint is_dynamic : 1; /* Contains dynamic types */
418 guint is_tb_open : 1; /* This is the fully open instantiation for a type_builder. Quite ugly, but it's temporary.*/
419 guint need_sync : 1; /* Only if dynamic. Need to be synchronized with its container class after its finished. */
420 MonoClass *cached_class; /* if present, the MonoClass corresponding to the instantiation. */
423 * The image set which owns this generic class. Memory owned by the generic class
424 * including cached_class should be allocated from the mempool of the image set,
425 * so it is easy to free.
427 MonoImageSet *owner;
430 /* Additional details about a MonoGenericParam */
431 /* Keep in sync with managed Mono.RuntimeStructs.GenericParamInfo */
432 typedef struct {
433 MonoClass *pklass; /* The corresponding `MonoClass'. */
434 const char *name;
436 // See GenericParameterAttributes
437 guint16 flags;
439 guint32 token;
441 // Constraints on type parameters
442 MonoClass** constraints; /* NULL means end of list */
443 } MonoGenericParamInfo;
446 * A type parameter.
448 struct _MonoGenericParam {
450 * Type or method this parameter was defined in.
452 MonoGenericContainer *owner;
453 guint16 num;
455 * If != NULL, this is a generated generic param used by the JIT to implement generic
456 * sharing.
458 MonoType *gshared_constraint;
460 MonoGenericParamInfo info;
463 typedef MonoGenericParam MonoGenericParamFull;
466 * The generic container.
468 * Stores the type parameters of a generic type definition or a generic method definition.
470 struct _MonoGenericContainer {
471 MonoGenericContext context;
472 /* If we're a generic method definition in a generic type definition,
473 the generic container of the containing class. */
474 MonoGenericContainer *parent;
475 /* the generic type definition or the generic method definition corresponding to this container */
476 /* Union rules: If is_anonymous, image field is valid; else if is_method, method field is valid; else klass is valid. */
477 union {
478 MonoClass *klass;
479 MonoMethod *method;
480 MonoImage *image;
481 } owner;
482 int type_argc : 29; // Per the ECMA spec, this value is capped at 16 bits
483 /* If true, we're a generic method, otherwise a generic type definition. */
484 /* Invariant: parent != NULL => is_method */
485 int is_method : 1;
486 /* If true, this container has no associated class/method and only the image is known. This can happen:
487 1. For the special anonymous containers kept by MonoImage.
488 2. When user code creates a generic parameter via SRE, but has not yet set an owner. */
489 int is_anonymous : 1;
490 /* Our type parameters. If this is a special anonymous container (case 1, above), this field is not valid, use mono_metadata_create_anon_gparam () */
491 MonoGenericParamFull *type_params;
494 static inline MonoGenericParam *
495 mono_generic_container_get_param (MonoGenericContainer *gc, int i)
497 return (MonoGenericParam *) &gc->type_params [i];
500 static inline MonoGenericParamInfo *
501 mono_generic_container_get_param_info (MonoGenericContainer *gc, int i)
503 return &gc->type_params [i].info;
506 static inline MonoGenericContainer *
507 mono_generic_param_owner (MonoGenericParam *p)
509 return p->owner;
512 static inline int
513 mono_generic_param_num (MonoGenericParam *p)
515 return p->num;
518 static inline MonoGenericParamInfo *
519 mono_generic_param_info (MonoGenericParam *p)
521 return &((MonoGenericParamFull *) p)->info;
524 static inline const char *
525 mono_generic_param_name (MonoGenericParam *p)
527 return ((MonoGenericParamFull *) p)->info.name;
530 static inline MonoGenericContainer *
531 mono_type_get_generic_param_owner (MonoType *t)
533 return mono_generic_param_owner (t->data.generic_param);
536 static inline int
537 mono_type_get_generic_param_num (MonoType *t)
539 return mono_generic_param_num (t->data.generic_param);
543 * Class information which might be cached by the runtime in the AOT file for
544 * example. Caching this allows us to avoid computing a generic vtable
545 * (class->vtable) in most cases, saving time and avoiding creation of lots of
546 * MonoMethod structures.
548 typedef struct MonoCachedClassInfo {
549 guint32 vtable_size;
550 guint has_finalize : 1;
551 guint ghcimpl : 1;
552 guint has_cctor : 1;
553 guint has_nested_classes : 1;
554 guint blittable : 1;
555 guint has_references : 1;
556 guint has_static_refs : 1;
557 guint no_special_static_fields : 1;
558 guint is_generic_container : 1;
559 guint has_weak_fields : 1;
560 guint32 cctor_token;
561 MonoImage *finalize_image;
562 guint32 finalize_token;
563 guint32 instance_size;
564 guint32 class_size;
565 guint32 packing_size;
566 guint32 min_align;
567 } MonoCachedClassInfo;
569 typedef struct {
570 const char *name;
571 gconstpointer func;
572 gconstpointer wrapper;
573 gconstpointer trampoline;
574 MonoMethodSignature *sig;
575 const char *c_symbol;
576 MonoMethod *wrapper_method;
577 } MonoJitICallInfo;
579 void
580 mono_class_setup_supertypes (MonoClass *klass);
582 /* WARNING
583 * Only call this function if you can ensure both @klass and @parent
584 * have supertype information initialized.
585 * This can be accomplished by mono_class_setup_supertypes or mono_class_init.
586 * If unsure, use mono_class_has_parent.
588 static inline gboolean
589 mono_class_has_parent_fast (MonoClass *klass, MonoClass *parent)
591 return (m_class_get_idepth (klass) >= m_class_get_idepth (parent)) && (m_class_get_supertypes (klass) [m_class_get_idepth (parent) - 1] == parent);
594 static inline gboolean
595 mono_class_has_parent (MonoClass *klass, MonoClass *parent)
597 if (G_UNLIKELY (!m_class_get_supertypes (klass)))
598 mono_class_setup_supertypes (klass);
600 if (G_UNLIKELY (!m_class_get_supertypes (parent)))
601 mono_class_setup_supertypes (parent);
603 return mono_class_has_parent_fast (klass, parent);
606 typedef struct {
607 MonoVTable *default_vtable;
608 MonoVTable *xdomain_vtable;
609 MonoClass *proxy_class;
610 char* proxy_class_name;
611 uint32_t interface_count;
612 MonoClass *interfaces [MONO_ZERO_LEN_ARRAY];
613 } MonoRemoteClass;
615 #define MONO_SIZEOF_REMOTE_CLASS (sizeof (MonoRemoteClass) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
617 typedef struct {
618 gint32 initialized_class_count;
619 gint32 generic_vtable_count;
620 gint32 used_class_count;
621 gint32 method_count;
622 gint32 class_vtable_size;
623 gint32 class_static_data_size;
624 gint32 generic_class_count;
625 gint32 inflated_method_count;
626 gint32 inflated_type_count;
627 gint32 delegate_creations;
628 gint32 imt_tables_size;
629 gint32 imt_number_of_tables;
630 gint32 imt_number_of_methods;
631 gint32 imt_used_slots;
632 gint32 imt_slots_with_collisions;
633 gint32 imt_max_collisions_in_slot;
634 gint32 imt_method_count_when_max_collisions;
635 gint32 imt_trampolines_size;
636 gint32 jit_info_table_insert_count;
637 gint32 jit_info_table_remove_count;
638 gint32 jit_info_table_lookup_count;
639 gint32 generics_sharable_methods;
640 gint32 generics_unsharable_methods;
641 gint32 generics_shared_methods;
642 gint32 gsharedvt_methods;
643 gboolean enabled;
644 } MonoStats;
647 * new structure to hold performace counters values that are exported
648 * to managed code.
649 * Note: never remove fields from this structure and only add them to the end.
650 * Size of fields and type should not be changed as well.
652 typedef struct {
653 /* JIT category */
654 gint32 jit_methods;
655 gint32 jit_bytes;
656 gint32 jit_time;
657 gint32 jit_failures;
658 /* Exceptions category */
659 gint32 exceptions_thrown;
660 gint32 exceptions_filters;
661 gint32 exceptions_finallys;
662 gint32 exceptions_depth;
663 gint32 aspnet_requests_queued;
664 gint32 aspnet_requests;
665 /* Memory category */
666 gint32 gc_collections0;
667 gint32 gc_collections1;
668 gint32 gc_collections2;
669 gint32 gc_promotions0;
670 gint32 gc_promotions1;
671 gint32 gc_promotion_finalizers;
672 gint64 gc_gen0size;
673 gint64 gc_gen1size;
674 gint64 gc_gen2size;
675 gint32 gc_lossize;
676 gint32 gc_fin_survivors;
677 gint32 gc_num_handles;
678 gint32 gc_allocated;
679 gint32 gc_induced;
680 gint32 gc_time;
681 gint64 gc_total_bytes;
682 gint64 gc_committed_bytes;
683 gint64 gc_reserved_bytes;
684 gint32 gc_num_pinned;
685 gint32 gc_sync_blocks;
686 /* Remoting category */
687 gint32 remoting_calls;
688 gint32 remoting_channels;
689 gint32 remoting_proxies;
690 gint32 remoting_classes;
691 gint32 remoting_objects;
692 gint32 remoting_contexts;
693 /* Loader category */
694 gint32 loader_classes;
695 gint32 loader_total_classes;
696 gint32 loader_appdomains;
697 gint32 loader_total_appdomains;
698 gint32 loader_assemblies;
699 gint32 loader_total_assemblies;
700 gint32 loader_failures;
701 gint32 loader_bytes;
702 gint32 loader_appdomains_uloaded;
703 /* Threads and Locks category */
704 gint32 thread_contentions;
705 gint32 thread_queue_len;
706 gint32 thread_queue_max;
707 gint32 thread_num_logical;
708 gint32 thread_num_physical;
709 gint32 thread_cur_recognized;
710 gint32 thread_num_recognized;
711 /* Interop category */
712 gint32 interop_num_ccw;
713 gint32 interop_num_stubs;
714 gint32 interop_num_marshals;
715 /* Security category */
716 gint32 security_num_checks;
717 gint32 security_num_link_checks;
718 gint32 security_time;
719 gint32 security_depth;
720 gint32 unused;
721 /* Threadpool */
722 gint32 threadpool_threads;
723 gint64 threadpool_workitems;
724 gint64 threadpool_ioworkitems;
725 gint32 threadpool_iothreads;
726 } MonoPerfCounters;
728 extern MonoPerfCounters *mono_perfcounters;
730 MONO_API void mono_perfcounters_init (void);
733 * The definition of the first field in SafeHandle,
734 * Keep in sync with SafeHandle.cs, this is only used
735 * to access the `handle' parameter.
737 typedef struct {
738 MonoObject base;
739 void *handle;
740 } MonoSafeHandle;
743 * Keep in sync with HandleRef.cs
745 typedef struct {
746 MonoObject *wrapper;
747 void *handle;
748 } MonoHandleRef;
750 extern MonoStats mono_stats;
752 typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
754 typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
756 static inline gboolean
757 method_is_dynamic (MonoMethod *method)
759 #ifdef DISABLE_REFLECTION_EMIT
760 return FALSE;
761 #else
762 return method->dynamic;
763 #endif
766 MonoMethod*
767 mono_class_get_method_by_index (MonoClass *klass, int index);
769 MonoMethod*
770 mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method, MonoError *error);
772 MonoMethod*
773 mono_class_get_vtable_entry (MonoClass *klass, int offset);
775 GPtrArray*
776 mono_class_get_implemented_interfaces (MonoClass *klass, MonoError *error);
779 mono_class_get_vtable_size (MonoClass *klass);
781 gboolean
782 mono_class_is_open_constructed_type (MonoType *t);
784 void
785 mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides, MonoGenericContext *generic_context, MonoError *error);
787 MonoMethod*
788 mono_class_get_cctor (MonoClass *klass) MONO_LLVM_INTERNAL;
790 MonoMethod*
791 mono_class_get_finalizer (MonoClass *klass);
793 gboolean
794 mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller);
796 gboolean
797 mono_class_field_is_special_static (MonoClassField *field);
799 guint32
800 mono_class_field_get_special_static_type (MonoClassField *field);
802 gboolean
803 mono_class_has_special_static_fields (MonoClass *klass);
805 const char*
806 mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_type);
808 const char*
809 mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def_type);
811 gpointer
812 mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error);
814 gpointer
815 mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, gboolean check_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
817 gpointer
818 mono_runtime_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper, MonoError *error);
820 gpointer
821 mono_runtime_create_delegate_trampoline (MonoClass *klass);
823 void
824 mono_install_get_cached_class_info (MonoGetCachedClassInfo func);
826 void
827 mono_install_get_class_from_name (MonoGetClassFromName func);
829 MONO_PROFILER_API MonoGenericContext*
830 mono_class_get_context (MonoClass *klass);
832 MONO_PROFILER_API MonoMethodSignature*
833 mono_method_signature_checked (MonoMethod *m, MonoError *err);
835 MONO_PROFILER_API MonoMethodSignature*
836 mono_method_signature_internal (MonoMethod *m);
838 MonoGenericContext*
839 mono_method_get_context_general (MonoMethod *method, gboolean uninflated);
841 MONO_PROFILER_API MonoGenericContext*
842 mono_method_get_context (MonoMethod *method);
844 /* Used by monodis, thus cannot be MONO_INTERNAL */
845 MONO_API MonoGenericContainer*
846 mono_method_get_generic_container (MonoMethod *method);
848 MonoGenericContext*
849 mono_generic_class_get_context (MonoGenericClass *gclass);
851 void
852 mono_method_set_generic_container (MonoMethod *method, MonoGenericContainer* container);
854 MonoMethod*
855 mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context, MonoError *error);
857 MonoMethod *
858 mono_class_inflate_generic_method_checked (MonoMethod *method, MonoGenericContext *context, MonoError *error);
860 MonoImageSet *
861 mono_metadata_get_image_set_for_class (MonoClass *klass);
863 MonoImageSet *
864 mono_metadata_get_image_set_for_method (MonoMethodInflated *method);
866 MONO_API MonoMethodSignature *
867 mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericContext *context);
869 MonoType*
870 mono_class_inflate_generic_type_with_mempool (MonoImage *image, MonoType *type, MonoGenericContext *context, MonoError *error);
872 MonoType*
873 mono_class_inflate_generic_type_checked (MonoType *type, MonoGenericContext *context, MonoError *error);
875 MONO_API void
876 mono_metadata_free_inflated_signature (MonoMethodSignature *sig);
878 MonoMethodSignature*
879 mono_inflate_generic_signature (MonoMethodSignature *sig, MonoGenericContext *context, MonoError *error);
881 MonoClass*
882 mono_generic_param_get_base_type (MonoClass *klass);
884 typedef struct {
885 MonoImage *corlib;
886 MonoClass *object_class;
887 MonoClass *byte_class;
888 MonoClass *void_class;
889 MonoClass *boolean_class;
890 MonoClass *sbyte_class;
891 MonoClass *int16_class;
892 MonoClass *uint16_class;
893 MonoClass *int32_class;
894 MonoClass *uint32_class;
895 MonoClass *int_class;
896 MonoClass *uint_class;
897 MonoClass *int64_class;
898 MonoClass *uint64_class;
899 MonoClass *single_class;
900 MonoClass *double_class;
901 MonoClass *char_class;
902 MonoClass *string_class;
903 MonoClass *enum_class;
904 MonoClass *array_class;
905 MonoClass *delegate_class;
906 MonoClass *multicastdelegate_class;
907 MonoClass *manualresetevent_class;
908 MonoClass *typehandle_class;
909 MonoClass *fieldhandle_class;
910 MonoClass *methodhandle_class;
911 MonoClass *systemtype_class;
912 MonoClass *runtimetype_class;
913 MonoClass *exception_class;
914 MonoClass *threadabortexception_class;
915 MonoClass *thread_class;
916 MonoClass *internal_thread_class;
917 #ifndef DISABLE_REMOTING
918 MonoClass *transparent_proxy_class;
919 MonoClass *real_proxy_class;
920 MonoClass *marshalbyrefobject_class;
921 MonoClass *iremotingtypeinfo_class;
922 #endif
923 MonoClass *mono_method_message_class;
924 MonoClass *appdomain_class;
925 MonoClass *field_info_class;
926 MonoClass *method_info_class;
927 MonoClass *stack_frame_class;
928 MonoClass *marshal_class;
929 MonoClass *typed_reference_class;
930 MonoClass *argumenthandle_class;
931 MonoClass *monitor_class;
932 MonoClass *generic_ilist_class;
933 MonoClass *generic_nullable_class;
934 MonoClass *attribute_class;
935 MonoClass *critical_finalizer_object; /* MAYBE NULL */
936 MonoClass *generic_ireadonlylist_class;
937 MonoClass *generic_ienumerator_class;
938 MonoMethod *threadpool_perform_wait_callback_method;
939 } MonoDefaults;
941 #ifdef DISABLE_REMOTING
942 #define mono_class_is_transparent_proxy(klass) (FALSE)
943 #define mono_class_is_real_proxy(klass) (FALSE)
944 #else
945 #define mono_class_is_transparent_proxy(klass) ((klass) == mono_defaults.transparent_proxy_class)
946 #define mono_class_is_real_proxy(klass) ((klass) == mono_defaults.real_proxy_class)
947 #endif
949 #define mono_object_is_transparent_proxy(object) (mono_class_is_transparent_proxy (mono_object_class (object)))
952 #define GENERATE_GET_CLASS_WITH_CACHE_DECL(shortname) \
953 MonoClass* mono_class_get_##shortname##_class (void);
955 #define GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(shortname) \
956 MonoClass* mono_class_try_get_##shortname##_class (void);
958 #define GENERATE_GET_CLASS_WITH_CACHE(shortname,name_space,name) \
959 MonoClass* \
960 mono_class_get_##shortname##_class (void) \
962 static MonoClass *tmp_class; \
963 MonoClass *klass = tmp_class; \
964 if (!klass) { \
965 klass = mono_class_load_from_name (mono_defaults.corlib, name_space, name); \
966 mono_memory_barrier (); \
967 tmp_class = klass; \
969 return klass; \
972 #define GENERATE_TRY_GET_CLASS_WITH_CACHE(shortname,name_space,name) \
973 MonoClass* \
974 mono_class_try_get_##shortname##_class (void) \
976 static volatile MonoClass *tmp_class; \
977 static volatile gboolean inited; \
978 MonoClass *klass = (MonoClass *)tmp_class; \
979 mono_memory_barrier (); \
980 if (!inited) { \
981 klass = mono_class_try_load_from_name (mono_defaults.corlib, name_space, name); \
982 tmp_class = klass; \
983 mono_memory_barrier (); \
984 inited = TRUE; \
986 return klass; \
989 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (safehandle)
991 #ifndef DISABLE_COM
993 GENERATE_GET_CLASS_WITH_CACHE_DECL (interop_proxy)
994 GENERATE_GET_CLASS_WITH_CACHE_DECL (idispatch)
995 GENERATE_GET_CLASS_WITH_CACHE_DECL (iunknown)
996 GENERATE_GET_CLASS_WITH_CACHE_DECL (com_object)
997 GENERATE_GET_CLASS_WITH_CACHE_DECL (variant)
999 #endif
1001 GENERATE_GET_CLASS_WITH_CACHE_DECL (appdomain_unloaded_exception)
1003 GENERATE_GET_CLASS_WITH_CACHE_DECL (valuetype)
1005 GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(handleref)
1006 /* If you need a MonoType, use one of the mono_get_*_type () functions in class-inlines.h */
1007 extern MonoDefaults mono_defaults;
1009 void
1010 mono_loader_init (void);
1012 void
1013 mono_loader_cleanup (void);
1015 void
1016 mono_loader_lock (void) MONO_LLVM_INTERNAL;
1018 void
1019 mono_loader_unlock (void) MONO_LLVM_INTERNAL;
1021 void
1022 mono_loader_lock_track_ownership (gboolean track);
1024 gboolean
1025 mono_loader_lock_is_owned_by_self (void);
1027 void
1028 mono_loader_lock_if_inited (void);
1030 void
1031 mono_loader_unlock_if_inited (void);
1033 void
1034 mono_reflection_init (void);
1036 void
1037 mono_icall_init (void);
1039 void
1040 mono_icall_cleanup (void);
1042 gpointer
1043 mono_method_get_wrapper_data (MonoMethod *method, guint32 id);
1045 gboolean
1046 mono_metadata_has_generic_params (MonoImage *image, guint32 token);
1048 MONO_API MonoGenericContainer *
1049 mono_metadata_load_generic_params (MonoImage *image, guint32 token,
1050 MonoGenericContainer *parent_container,
1051 gpointer real_owner);
1053 MONO_API gboolean
1054 mono_metadata_load_generic_param_constraints_checked (MonoImage *image, guint32 token,
1055 MonoGenericContainer *container, MonoError *error);
1057 MonoMethodSignature*
1058 mono_create_icall_signature (const char *sigstr);
1060 MonoJitICallInfo *
1061 mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save);
1063 MonoJitICallInfo *
1064 mono_register_jit_icall_full (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean no_wrapper, const char *c_symbol);
1066 #ifdef __cplusplus
1067 template <typename T>
1068 inline MonoJitICallInfo *
1069 mono_register_jit_icall (T func, const char *name, MonoMethodSignature *sig, gboolean is_save)
1071 return mono_register_jit_icall ((gconstpointer)func, name, sig, is_save);
1074 template <typename T>
1075 inline MonoJitICallInfo *
1076 mono_register_jit_icall_full (T func, const char *name, MonoMethodSignature *sig, gboolean no_wrapper, const char *c_symbol)
1078 return mono_register_jit_icall_full ((gconstpointer)func, name, sig, no_wrapper, c_symbol);
1080 #endif // __cplusplus
1082 void
1083 mono_register_jit_icall_wrapper (MonoJitICallInfo *info, gconstpointer wrapper);
1085 MonoJitICallInfo *
1086 mono_find_jit_icall_by_name (const char *name) MONO_LLVM_INTERNAL;
1088 MonoJitICallInfo *
1089 mono_find_jit_icall_by_addr (gconstpointer addr) MONO_LLVM_INTERNAL;
1091 GHashTable*
1092 mono_get_jit_icall_info (void);
1094 const char*
1095 mono_lookup_jit_icall_symbol (const char *name);
1097 gboolean
1098 mono_class_set_type_load_failure (MonoClass *klass, const char * fmt, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
1100 MonoException*
1101 mono_class_get_exception_for_failure (MonoClass *klass);
1103 char*
1104 mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
1106 char*
1107 mono_type_get_full_name (MonoClass *klass);
1109 char *
1110 mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret, MonoTypeNameFormat format);
1112 MONO_PROFILER_API char *
1113 mono_method_get_full_name (MonoMethod *method);
1115 const char*
1116 mono_wrapper_type_to_str (guint32 wrapper_type);
1118 MonoArrayType *mono_dup_array_type (MonoImage *image, MonoArrayType *a);
1119 MonoMethodSignature *mono_metadata_signature_deep_dup (MonoImage *image, MonoMethodSignature *sig);
1121 MONO_API void
1122 mono_image_init_name_cache (MonoImage *image);
1124 gboolean mono_class_is_nullable (MonoClass *klass);
1125 MonoClass *mono_class_get_nullable_param (MonoClass *klass);
1127 /* object debugging functions, for use inside gdb */
1128 MONO_API void mono_object_describe (MonoObject *obj);
1129 MONO_API void mono_object_describe_fields (MonoObject *obj);
1130 MONO_API void mono_value_describe_fields (MonoClass* klass, const char* addr);
1131 MONO_API void mono_class_describe_statics (MonoClass* klass);
1133 /* method debugging functions, for use inside gdb */
1134 MONO_API void mono_method_print_code (MonoMethod *method);
1136 MONO_PROFILER_API char *mono_signature_full_name (MonoMethodSignature *sig);
1138 /*Enum validation related functions*/
1139 MONO_API gboolean
1140 mono_type_is_valid_enum_basetype (MonoType * type);
1142 MONO_API gboolean
1143 mono_class_is_valid_enum (MonoClass *klass);
1145 MONO_PROFILER_API gboolean
1146 mono_type_is_primitive (MonoType *type);
1148 MonoType *
1149 mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
1151 gboolean
1152 mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass);
1154 MonoType*
1155 mono_type_get_basic_type_from_generic (MonoType *type);
1157 gboolean
1158 mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, MonoClass *context_klass);
1160 gboolean
1161 mono_method_can_access_field_full (MonoMethod *method, MonoClassField *field, MonoClass *context_klass);
1163 gboolean
1164 mono_class_can_access_class (MonoClass *access_class, MonoClass *target_class);
1166 MonoClass *
1167 mono_class_get_generic_type_definition (MonoClass *klass);
1169 gboolean
1170 mono_class_has_parent_and_ignore_generics (MonoClass *klass, MonoClass *parent);
1173 mono_method_get_vtable_slot (MonoMethod *method);
1176 mono_method_get_vtable_index (MonoMethod *method);
1178 MonoMethod*
1179 mono_method_get_base_method (MonoMethod *method, gboolean definition, MonoError *error);
1181 MonoMethod*
1182 mono_method_search_in_array_class (MonoClass *klass, const char *name, MonoMethodSignature *sig);
1184 void
1185 mono_class_setup_interface_id (MonoClass *klass);
1187 MonoGenericContainer*
1188 mono_class_get_generic_container (MonoClass *klass);
1190 gpointer
1191 mono_class_alloc (MonoClass *klass, int size);
1193 gpointer
1194 mono_class_alloc0 (MonoClass *klass, int size);
1196 #define mono_class_alloc0(klass, size) (g_cast (mono_class_alloc0 ((klass), (size))))
1198 void
1199 mono_class_setup_interfaces (MonoClass *klass, MonoError *error);
1201 MonoClassField*
1202 mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoType *type);
1204 MonoVTable*
1205 mono_class_vtable_checked (MonoDomain *domain, MonoClass *klass, MonoError *error);
1207 void
1208 mono_class_is_assignable_from_checked (MonoClass *klass, MonoClass *oklass, gboolean *result, MonoError *error);
1210 gboolean
1211 mono_class_is_assignable_from_slow (MonoClass *target, MonoClass *candidate);
1213 gboolean
1214 mono_class_has_variant_generic_params (MonoClass *klass);
1216 gboolean
1217 mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass, gboolean check_for_reference_conv);
1219 mono_bool
1220 mono_class_is_assignable_from_internal (MonoClass *klass, MonoClass *oklass);
1222 gboolean mono_is_corlib_image (MonoImage *image);
1224 MonoType*
1225 mono_field_get_type_checked (MonoClassField *field, MonoError *error);
1227 MonoType*
1228 mono_field_get_type_internal (MonoClassField *field);
1230 MonoClassField*
1231 mono_class_get_fields_internal (MonoClass* klass, gpointer *iter);
1233 MonoClassField*
1234 mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter);
1236 gboolean
1237 mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup);
1239 gboolean
1240 mono_class_has_finalizer (MonoClass *klass);
1242 void
1243 mono_unload_interface_id (MonoClass *klass);
1245 GPtrArray*
1246 mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, guint32 mlisttype, gboolean allow_ctors, MonoError *error);
1248 char*
1249 mono_class_full_name (MonoClass *klass);
1251 MonoClass*
1252 mono_class_inflate_generic_class_checked (MonoClass *gklass, MonoGenericContext *context, MonoError *error);
1254 MONO_PROFILER_API MonoClass *
1255 mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error);
1257 MonoClass *
1258 mono_class_get_and_inflate_typespec_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
1260 MonoClass *
1261 mono_class_from_name_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error);
1263 MonoClass *
1264 mono_class_from_name_case_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error);
1266 MONO_PROFILER_API MonoClass *
1267 mono_class_from_mono_type_internal (MonoType *type);
1269 MonoClassField*
1270 mono_field_from_token_checked (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context, MonoError *error);
1272 gpointer
1273 mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
1275 MonoImage *
1276 mono_get_image_for_generic_param (MonoGenericParam *param);
1278 char *
1279 mono_make_generic_name_string (MonoImage *image, int num);
1281 MonoClass *
1282 mono_class_load_from_name (MonoImage *image, const char* name_space, const char *name) MONO_LLVM_INTERNAL;
1284 MonoClass*
1285 mono_class_try_load_from_name (MonoImage *image, const char* name_space, const char *name);
1287 void
1288 mono_error_set_for_class_failure (MonoError *orerror, const MonoClass *klass);
1290 gboolean
1291 mono_class_has_failure (const MonoClass *klass);
1293 /* Kind specific accessors */
1294 MonoGenericClass*
1295 mono_class_get_generic_class (MonoClass *klass);
1297 MonoGenericClass*
1298 mono_class_try_get_generic_class (MonoClass *klass);
1300 void
1301 mono_class_set_flags (MonoClass *klass, guint32 flags);
1303 MonoGenericContainer*
1304 mono_class_try_get_generic_container (MonoClass *klass);
1306 void
1307 mono_class_set_generic_container (MonoClass *klass, MonoGenericContainer *container);
1309 MonoType*
1310 mono_class_gtd_get_canonical_inst (MonoClass *klass);
1312 guint32
1313 mono_class_get_first_method_idx (MonoClass *klass);
1315 void
1316 mono_class_set_first_method_idx (MonoClass *klass, guint32 idx);
1318 guint32
1319 mono_class_get_first_field_idx (MonoClass *klass);
1321 void
1322 mono_class_set_first_field_idx (MonoClass *klass, guint32 idx);
1324 guint32
1325 mono_class_get_method_count (MonoClass *klass);
1327 void
1328 mono_class_set_method_count (MonoClass *klass, guint32 count);
1330 guint32
1331 mono_class_get_field_count (MonoClass *klass);
1333 void
1334 mono_class_set_field_count (MonoClass *klass, guint32 count);
1336 MonoMarshalType*
1337 mono_class_get_marshal_info (MonoClass *klass);
1339 void
1340 mono_class_set_marshal_info (MonoClass *klass, MonoMarshalType *marshal_info);
1342 guint32
1343 mono_class_get_ref_info_handle (MonoClass *klass);
1345 guint32
1346 mono_class_set_ref_info_handle (MonoClass *klass, guint32 value);
1348 MonoErrorBoxed*
1349 mono_class_get_exception_data (MonoClass *klass);
1351 void
1352 mono_class_set_exception_data (MonoClass *klass, MonoErrorBoxed *value);
1354 GList*
1355 mono_class_get_nested_classes_property (MonoClass *klass);
1357 void
1358 mono_class_set_nested_classes_property (MonoClass *klass, GList *value);
1360 MonoClassPropertyInfo*
1361 mono_class_get_property_info (MonoClass *klass);
1363 void
1364 mono_class_set_property_info (MonoClass *klass, MonoClassPropertyInfo *info);
1366 MonoClassEventInfo*
1367 mono_class_get_event_info (MonoClass *klass);
1369 void
1370 mono_class_set_event_info (MonoClass *klass, MonoClassEventInfo *info);
1372 MonoFieldDefaultValue*
1373 mono_class_get_field_def_values (MonoClass *klass);
1375 void
1376 mono_class_set_field_def_values (MonoClass *klass, MonoFieldDefaultValue *values);
1378 guint32
1379 mono_class_get_declsec_flags (MonoClass *klass);
1381 void
1382 mono_class_set_declsec_flags (MonoClass *klass, guint32 value);
1384 void
1385 mono_class_set_is_com_object (MonoClass *klass);
1387 void
1388 mono_class_set_weak_bitmap (MonoClass *klass, int nbits, gsize *bits);
1390 gsize*
1391 mono_class_get_weak_bitmap (MonoClass *klass, int *nbits);
1393 gboolean
1394 mono_class_has_dim_conflicts (MonoClass *klass);
1396 void
1397 mono_class_set_dim_conflicts (MonoClass *klass, GSList *conflicts);
1399 GSList*
1400 mono_class_get_dim_conflicts (MonoClass *klass);
1402 MonoMethod *
1403 mono_class_get_method_from_name_checked (MonoClass *klass, const char *name, int param_count, int flags, MonoError *error);
1405 gboolean
1406 mono_method_has_no_body (MonoMethod *method);
1408 // FIXME Replace all internal callers of mono_method_get_header_checked with
1409 // mono_method_get_header_internal; the difference is in error initialization.
1411 // And then mark mono_method_get_header_checked as MONO_RT_EXTERNAL_ONLY MONO_API.
1413 // Internal callers expected to use ERROR_DECL. External callers are not.
1414 MonoMethodHeader*
1415 mono_method_get_header_internal (MonoMethod *method, MonoError *error);
1417 MonoType*
1418 mono_class_find_enum_basetype (MonoClass *klass, MonoError *error);
1420 gboolean
1421 mono_class_set_failure (MonoClass *klass, MonoErrorBoxed *boxed_error);
1423 gboolean
1424 mono_class_set_type_load_failure_causedby_class (MonoClass *klass, const MonoClass *caused_by, const gchar* msg);
1426 gboolean mono_class_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res);
1428 MonoMethod* mono_find_method_in_metadata (MonoClass *klass, const char *name, int param_count, int flags);
1431 mono_class_get_object_finalize_slot (void);
1433 MonoMethod *
1434 mono_class_get_default_finalize_method (void);
1436 void
1437 mono_field_resolve_type (MonoClassField *field, MonoError *error);
1439 gboolean
1440 mono_type_has_exceptions (MonoType *type);
1442 void
1443 mono_class_set_nonblittable (MonoClass *klass);
1445 gboolean
1446 mono_class_publish_gc_descriptor (MonoClass *klass, MonoGCDescriptor gc_descr);
1448 void
1449 mono_class_compute_gc_descriptor (MonoClass *klass);
1451 #ifndef DISABLE_REMOTING
1452 void
1453 mono_class_contextbound_bit_offset (int* byte_offset_out, guint8* mask_out);
1454 #endif
1456 gboolean
1457 mono_class_init_checked (MonoClass *klass, MonoError *error);
1459 MonoType*
1460 mono_class_enum_basetype_internal (MonoClass *klass);
1462 /*Now that everything has been defined, let's include the inline functions */
1463 #include <mono/metadata/class-inlines.h>
1465 #endif /* __MONO_METADATA_CLASS_INTERNALS_H__ */