1 #ifndef _MONO_CLI_CLASS_H_
2 #define _MONO_CLI_CLASS_H_
4 #include <mono/metadata/metadata.h>
5 #include <mono/metadata/image.h>
6 #include <mono/metadata/loader.h>
8 #define MONO_CLASS_IS_ARRAY(c) ((c)->rank)
10 extern gboolean mono_print_vtable;
11 typedef struct MonoVTable MonoVTable;
21 MonoClassField *field;
23 MonoMarshalSpec *mspec;
29 MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
52 * relative numbering for fast type checking
57 /* The underlying type of the enum */
58 MonoType *enum_basetype;
59 /* element class for arrays and enum */
60 MonoClass *element_class;
61 /* used for subtype checks */
62 MonoClass *cast_class;
67 /* We use init_pending to detect cyclic calls to mono_class_init */
68 guint init_pending : 1;
70 /* A class contains static and non static data. Static data can be
71 * of the same type as the class itselfs, but it does not influence
72 * the instance size of the class. To avoid cyclic calls to
73 * mono_class_init (from mono_class_instance_size ()) we first
74 * initialise all non static fields. After that we set size_inited
75 * to 1, because we know the instance size now. After that we
76 * initialise all static fields.
78 guint size_inited : 1;
79 guint valuetype : 1; /* derives from System.ValueType */
80 guint enumtype : 1; /* derives from System.Enum */
81 guint blittable : 1; /* class is blittable */
82 guint unicode : 1; /* class uses unicode char when marshalled */
83 guint wastypebuilder : 1; /* class was created at runtime from a TypeBuilder */
86 guint packing_size : 4;
88 guint ghcimpl : 1; /* class has its own GetHashCode impl */
89 guint has_finalize : 1; /* class has its own Finalize impl */
90 guint marshalbyref : 1; /* class is a MarshalByRefObject */
91 guint contextbound : 1; /* class is a ContextBoundObject */
92 guint delegate : 1; /* class is a Delegate */
93 guint dummy : 1; /* temorary hack */
97 GList *nested_classes;
98 GList *subclasses; /* list of all subclasses */
102 const char *name_space;
104 guint interface_count;
105 guint interface_id; /* unique inderface id (for interfaces) */
106 guint max_interface_id;
107 gint *interface_offsets;
108 MonoClass **interfaces;
111 * Computed object instance size, total.
115 int vtable_size; /* number of slots */
118 * From the TypeDef table
124 } field, method, property, event;
126 /* loaded on demand */
127 MonoMarshalType *marshal_info;
130 * Field information: Type and location from object base
132 MonoClassField *fields;
134 MonoProperty *properties;
138 MonoMethod **methods;
140 /* used as the type of the this argument and when passing the arg by value */
144 void *reflection_info;
146 MonoMethod *ptr_to_str;
147 MonoMethod *str_to_ptr;
149 MonoVTable *cached_vtable;
155 MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
156 guint max_interface_id;
157 gpointer *interface_offsets;
159 gpointer vtable [MONO_ZERO_LEN_ARRAY];
163 gulong new_object_count;
164 gulong initialized_class_count;
165 gulong used_class_count;
166 gulong class_vtable_size;
167 gulong class_static_data_size;
170 extern MonoStats mono_stats;
172 typedef gpointer (*MonoTrampoline) (MonoMethod *method);
175 mono_class_get (MonoImage *image, guint32 type_token);
178 mono_class_init (MonoClass *klass);
181 mono_class_layout_fields (MonoClass *klass);
184 mono_class_setup_vtable (MonoClass *klass);
187 mono_class_vtable (MonoDomain *domain, MonoClass *klass);
190 mono_class_proxy_vtable (MonoDomain *domain, MonoClass *klass);
193 mono_class_setup_mono_type (MonoClass *klass);
196 mono_class_setup_parent (MonoClass *klass, MonoClass *parent);
199 mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
202 mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name);
205 mono_class_from_typeref (MonoImage *image, guint32 type_token);
208 mono_field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass);
211 mono_field_from_token (MonoImage *image, guint32 token, MonoClass **retklass);
214 mono_class_get_overrides (MonoImage *image, guint32 type_token, gint32 *num_overrides);
217 mono_array_class_get (MonoType *element_type, guint32 rank);
220 mono_ptr_class_get (MonoType *type);
223 mono_class_get_field (MonoClass *klass, guint32 field_token);
226 mono_class_get_field_from_name (MonoClass *klass, const char *name);
229 mono_class_get_property_from_name (MonoClass *klass, const char *name);
232 mono_array_element_size (MonoClass *ac);
235 mono_class_instance_size (MonoClass *klass);
238 mono_class_data_size (MonoClass *klass);
241 mono_class_value_size (MonoClass *klass, guint32 *align);
244 mono_class_native_size (MonoClass *klass, guint32 *align);
247 mono_marshal_load_type_info (MonoClass* klass);
250 mono_class_min_align (MonoClass *klass);
253 mono_class_from_mono_type (MonoType *type);
256 mono_ldtoken (MonoImage *image, guint32 token, MonoClass **retclass);
259 mono_install_trampoline (MonoTrampoline func);
262 mono_install_remoting_trampoline (MonoTrampoline func);
264 #endif /* _MONO_CLI_CLASS_H_ */