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 guint dummy : 1; /* temorary hack */
54 /* We use init_pending to detect cyclic calls to mono_class_init */
55 guint init_pending : 1;
57 /* A class contains static and non static data. Static data can be
58 * of the same type as the class itselfs, but it does not influence
59 * the instance size of the class. To avoid cyclic calls to
60 * mono_class_init (from mono_class_instance_size ()) we first
61 * initialise all non static fields. After that we set size_inited
62 * to 1, because we know the instance size now. After that we
63 * initialise all static fields.
65 guint size_inited : 1;
66 guint valuetype : 1; /* derives from System.ValueType */
67 guint enumtype : 1; /* derives from System.Enum */
68 guint ghcimpl : 1; /* class has its own GetHashCode impl */
69 guint has_finalize : 1; /* class has its own Finalize impl */
70 guint marshalbyref : 1; /* class is a MarshalByRefObject */
71 guint contextbound : 1; /* class is a ContextBoundObject */
72 guint delegate : 1; /* class is a Delegate */
74 guint packing_size : 4;
75 guint blittable : 1; /* class is blittable */
76 guint unicode : 1; /* class uses unicode char when marshalled */
80 GList *nested_classes;
81 GList *subclasses; /* list of all subclasses */
84 const char *name_space;
86 guint interface_count;
87 guint interface_id; /* unique inderface id (for interfaces) */
88 guint max_interface_id;
89 gint *interface_offsets;
90 MonoClass **interfaces;
93 * Computed object instance size, total.
97 int vtable_size; /* number of slots */
100 * relative numbering for fast type checking
102 unsigned int baseval;
103 unsigned int diffval;
106 * From the TypeDef table
112 } field, method, property, event;
114 /* loaded on demand */
115 MonoMarshalType *marshal_info;
118 * Field information: Type and location from object base
120 MonoClassField *fields;
122 MonoProperty *properties;
126 MonoMethod **methods;
128 /* The underlying type of the enum */
129 MonoType *enum_basetype;
130 /* element class for arrays and enum */
131 MonoClass *element_class;
132 /* array dimension */
135 /* used as the type of the this argument and when passing the arg by value */
139 void *reflection_info;
141 MonoMethod *ptr_to_str;
142 MonoMethod *str_to_ptr;
144 MonoVTable *cached_vtable;
150 MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
151 guint max_interface_id;
152 gpointer *interface_offsets;
154 gpointer vtable [MONO_ZERO_LEN_ARRAY];
158 gulong new_object_count;
159 gulong initialized_class_count;
160 gulong used_class_count;
161 gulong class_vtable_size;
162 gulong class_static_data_size;
165 extern MonoStats mono_stats;
167 typedef gpointer (*MonoTrampoline) (MonoMethod *method);
170 mono_class_get (MonoImage *image, guint32 type_token);
173 mono_class_init (MonoClass *klass);
176 mono_class_vtable (MonoDomain *domain, MonoClass *class);
179 mono_class_proxy_vtable (MonoDomain *domain, MonoClass *class);
182 mono_class_setup_mono_type (MonoClass *class);
185 mono_class_setup_parent (MonoClass *class, MonoClass *parent);
188 mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
191 mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name);
194 mono_class_from_typeref (MonoImage *image, guint32 type_token);
197 mono_field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass);
200 mono_field_from_token (MonoImage *image, guint32 token, MonoClass **retklass);
203 mono_class_get_overrides (MonoImage *image, guint32 type_token, gint32 *num_overrides);
206 mono_array_class_get (MonoType *element_type, guint32 rank);
209 mono_ptr_class_get (MonoType *type);
212 mono_class_get_field (MonoClass *klass, guint32 field_token);
215 mono_class_get_field_from_name (MonoClass *klass, const char *name);
218 mono_array_element_size (MonoClass *ac);
221 mono_class_instance_size (MonoClass *klass);
224 mono_class_data_size (MonoClass *klass);
227 mono_class_value_size (MonoClass *klass, guint32 *align);
230 mono_class_native_size (MonoClass *klass, guint32 *align);
233 mono_marshal_load_type_info (MonoClass* klass);
236 mono_class_min_align (MonoClass *klass);
239 mono_class_from_mono_type (MonoType *type);
242 mono_ldtoken (MonoImage *image, guint32 token, MonoClass **retclass);
245 mono_install_trampoline (MonoTrampoline func);
248 mono_install_remoting_trampoline (MonoTrampoline func);
250 #endif /* _MONO_CLI_CLASS_H_ */