2 * \file Definitions of struct _MonoClass members
4 * NOTE: This file should NOT be included directly.
7 #if defined(MONO_CLASS_DEF_PRIVATE) && !defined(REALLY_INCLUDE_CLASS_DEF)
8 #error struct _MonoClass definition should not be accessed directly
11 #ifndef __MONO_METADATA_CLASS_PRIVATE_DEFINITION_H__
12 #define __MONO_METADATA_CLASS_PRIVATE_DEFINITION_H__
15 /* element class for arrays and enum basetype for enums */
16 MonoClass
*element_class
;
17 /* used for subtype checks */
18 MonoClass
*cast_class
;
20 /* for fast subtype checks */
21 MonoClass
**supertypes
;
27 int instance_size
; /* object instance size */
31 /* A class contains static and non static data. Static data can be
32 * of the same type as the class itselfs, but it does not influence
33 * the instance size of the class. To avoid cyclic calls to
34 * mono_class_init (from mono_class_instance_size ()) we first
35 * initialise all non static fields. After that we set size_inited
36 * to 1, because we know the instance size now. After that we
37 * initialise all static fields.
40 /* ALL BITFIELDS SHOULD BE WRITTEN WHILE HOLDING THE LOADER LOCK */
41 guint size_inited
: 1;
42 guint valuetype
: 1; /* derives from System.ValueType */
43 guint enumtype
: 1; /* derives from System.Enum */
44 guint blittable
: 1; /* class is blittable */
45 guint unicode
: 1; /* class uses unicode char when marshalled */
46 guint wastypebuilder
: 1; /* class was created at runtime from a TypeBuilder */
47 guint is_array_special_interface
: 1; /* gtd or ginst of once of the magic interfaces that arrays implement */
53 guint packing_size
: 4;
54 guint ghcimpl
: 1; /* class has its own GetHashCode impl */
55 guint has_finalize
: 1; /* class has its own Finalize impl */
56 #ifndef DISABLE_REMOTING
57 guint marshalbyref
: 1; /* class is a MarshalByRefObject */
58 guint contextbound
: 1; /* class is a ContextBoundObject */
61 guint delegate
: 1; /* class is a Delegate */
62 guint gc_descr_inited
: 1; /* gc_descr is initialized */
63 guint has_cctor
: 1; /* class has a cctor */
64 guint has_references
: 1; /* it has GC-tracked references in the instance */
65 guint has_static_refs
: 1; /* it has static fields that are GC-tracked */
66 guint no_special_static_fields
: 1; /* has no thread/context static fields */
67 /* directly or indirectly derives from ComImport attributed class.
68 * this means we need to create a proxy for instances of this class
69 * for COM Interop. set this flag on loading so all we need is a quick check
70 * during object creation rather than having to traverse supertypes
72 guint is_com_object
: 1;
73 guint nested_classes_inited
: 1; /* Whenever nested_class is initialized */
76 guint class_kind
: 3; /* One of the values from MonoTypeKind */
77 guint interfaces_inited
: 1; /* interfaces is initialized */
78 guint simd_type
: 1; /* class is a simd intrinsic type */
79 guint has_finalize_inited
: 1; /* has_finalize is initialized */
80 guint fields_inited
: 1; /* setup_fields () has finished */
81 guint has_failure
: 1; /* See mono_class_get_exception_data () for a MonoErrorBoxed with the details */
82 guint has_weak_fields
: 1; /* class has weak reference fields */
83 guint has_dim_conflicts
: 1; /* Class has conflicting default interface methods */
90 const char *name_space
;
93 int vtable_size
; /* number of slots */
95 guint16 interface_count
;
96 guint32 interface_id
; /* unique inderface id (for interfaces) */
97 guint32 max_interface_id
;
99 guint16 interface_offsets_count
;
100 MonoClass
**interfaces_packed
;
101 guint16
*interface_offsets_packed
;
102 guint8
*interface_bitmap
;
104 MonoClass
**interfaces
;
106 union _MonoClassSizes sizes
;
109 * Field information: Type and location from object base
111 MonoClassField
*fields
;
113 MonoMethod
**methods
;
115 /* used as the type of the this argument and when passing the arg by value */
119 MonoGCDescriptor gc_descr
;
121 MonoClassRuntimeInfo
*runtime_info
;
123 /* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
126 /* Infrequently used items. See class-accessors.c: InfrequentDataKind for what goes into here. */
127 MonoPropertyBag infrequent_data
;
130 struct _MonoClassDef
{
134 * From the TypeDef table
136 guint32 first_method_idx
;
137 guint32 first_field_idx
;
138 guint32 method_count
, field_count
;
139 /* next element in the class_cache hash list (in MonoImage) */
140 MonoClass
*next_class_cache
;
143 struct _MonoClassGtd
{
145 MonoGenericContainer
*generic_container
;
146 /* The canonical GENERICINST where we instantiate a generic type definition with its own generic parameters.*/
147 /* Suppose we have class T`2<A,B> {...}. canonical_inst is the GTD T`2 applied to A and B. */
148 MonoType canonical_inst
;
151 struct _MonoClassGenericInst
{
153 MonoGenericClass
*generic_class
;
156 struct _MonoClassGenericParam
{
160 struct _MonoClassArray
{
162 guint32 method_count
;
165 struct _MonoClassPointer
{