#include <mono/metadata/image.h>
#include <mono/metadata/loader.h>
-#define MONO_CLASS_IS_ARRAY(c) ((c)->rank)
-
-#define MONO_DEFAULT_SUPERTABLE_SIZE 6
-
-extern gboolean mono_print_vtable;
typedef struct MonoVTable MonoVTable;
-typedef struct {
- MonoTypeEnum type;
- gpointer value;
-} MonoConstant;
-
-/*
- * MonoClassField is just a runtime representation of the metadata for
- * field, it doesn't contain the data directly. Static fields are
- * stored in MonoVTable->data. Instance fields are allocated in the
- * objects after the object header.
- */
-typedef struct {
- /* Type of the field */
- MonoType *type;
-
- /*
- * Offset where this field is stored; if it is an instance
- * field, it's the offset from the start of the object, if
- * it's static, it's from the start of the memory chunk
- * allocated for statics for the class.
- */
- int offset;
-
- const char *name;
-
- /*
- * Pointer to the data (from the RVA address, valid only for
- * fields with the has rva flag).
- */
- const char *data;
-
- /* Type where the field was defined */
- MonoClass *parent;
-
- /*
- * If the field is constant, pointer to the metadata where the
- * constant value can be loaded. Initialized lazily during vtable creation.
- */
- MonoConstant *def_value;
-} MonoClassField;
-
-/* a field is ignored if it's named "_Deleted" and it has the specialname and rtspecialname flags set */
-#define mono_field_is_deleted(field) ((field)->name[0] == '_' && ((field)->type->attrs & 0x600) && (strcmp ((field)->name, "_Deleted") == 0))
-
-typedef struct {
- MonoClassField *field;
- guint32 offset;
- MonoMarshalSpec *mspec;
-} MonoMarshalField;
-
-typedef struct {
- guint32 native_size;
- guint32 num_fields;
- MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
-} MonoMarshalType;
-
-typedef struct {
- const char *name;
- MonoMethod *get;
- MonoMethod *set;
- guint32 attrs;
-} MonoProperty;
+typedef struct _MonoClassField MonoClassField;
+typedef struct _MonoProperty MonoProperty;
+typedef struct _MonoEvent MonoEvent;
typedef struct {
- const char *name;
- MonoMethod *add;
- MonoMethod *remove;
- MonoMethod *raise;
- MonoMethod **other;
- guint32 attrs;
-} MonoEvent;
-
-struct _MonoClass {
- MonoImage *image;
-
- /* The underlying type of the enum */
- MonoType *enum_basetype;
- /* element class for arrays and enum */
- MonoClass *element_class;
- /* used for subtype checks */
- MonoClass *cast_class;
- /* array dimension */
- guint32 rank;
-
- guint inited : 1;
- /* We use init_pending to detect cyclic calls to mono_class_init */
- guint init_pending : 1;
-
- /* A class contains static and non static data. Static data can be
- * of the same type as the class itselfs, but it does not influence
- * the instance size of the class. To avoid cyclic calls to
- * mono_class_init (from mono_class_instance_size ()) we first
- * initialise all non static fields. After that we set size_inited
- * to 1, because we know the instance size now. After that we
- * initialise all static fields.
- */
- guint size_inited : 1;
- guint valuetype : 1; /* derives from System.ValueType */
- guint enumtype : 1; /* derives from System.Enum */
- guint blittable : 1; /* class is blittable */
- guint unicode : 1; /* class uses unicode char when marshalled */
- guint wastypebuilder : 1; /* class was created at runtime from a TypeBuilder */
- /* next byte */
- guint min_align : 4;
- guint packing_size : 4;
- /* next byte */
- guint ghcimpl : 1; /* class has its own GetHashCode impl */
- guint has_finalize : 1; /* class has its own Finalize impl */
- guint marshalbyref : 1; /* class is a MarshalByRefObject */
- guint contextbound : 1; /* class is a ContextBoundObject */
- guint delegate : 1; /* class is a Delegate */
- guint gc_descr_inited : 1; /* gc_descr is initialized */
- guint dummy : 1; /* temporary hack */
-
- MonoClass *parent;
- MonoClass *nested_in;
- GList *nested_classes;
-
- guint32 type_token;
- const char *name;
- const char *name_space;
-
- guint interface_count;
- guint interface_id; /* unique inderface id (for interfaces) */
- guint max_interface_id;
- gint *interface_offsets;
+ MonoVTable *default_vtable;
+ MonoVTable *xdomain_vtable;
+ MonoClass *proxy_class;
+ guint interface_count;
MonoClass **interfaces;
-
- /* for fast subtype checks */
- guint idepth;
- MonoClass **supertypes;
-
- /*
- * Computed object instance size, total.
- */
- int instance_size;
- int class_size;
- int vtable_size; /* number of slots */
-
- /*
- * From the TypeDef table
- */
- guint32 flags;
- struct {
- guint32 first, last;
- int count;
- } field, method, property, event;
-
- /* loaded on demand */
- MonoMarshalType *marshal_info;
-
- /*
- * Field information: Type and location from object base
- */
- MonoClassField *fields;
-
- MonoProperty *properties;
-
- MonoEvent *events;
-
- MonoMethod **methods;
-
- /* used as the type of the this argument and when passing the arg by value */
- MonoType this_arg;
- MonoType byval_arg;
-
- MonoType *generic_inst;
- MonoGenericParam *gen_params;
- guint16 num_gen_params;
-
- void *reflection_info;
-
- void *gc_descr;
- guint64 gc_bitmap;
-
- MonoMethod *ptr_to_str;
- MonoMethod *str_to_ptr;
-
- MonoVTable *cached_vtable;
- MonoMethod **vtable;
-};
-
-struct MonoVTable {
- MonoClass *klass;
- /*
- * According to comments in gc_gcj.h, this should be the second word in
- * the vtable.
- */
- void *gc_descr;
- MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
- guint max_interface_id;
- gpointer *interface_offsets;
- gpointer data; /* to store static class data */
- guint remote : 1; /* class is remotely activated */
- guint initialized : 1; /* cctor has been run */
- guint initializing : 1; /* cctor is running */
- /* do not add any fields after vtable, the structure is dynamically extended */
- gpointer vtable [MONO_ZERO_LEN_ARRAY];
-};
-
-/*
- * Generic instantiation data type encoding.
- */
-struct _MonoGenericInst {
- MonoClass *klass;
- MonoType *generic_type;
- MonoMethod *generic_method;
- int type_argc;
- MonoType **type_argv;
- guint is_open : 1;
- guint initialized : 1;
- guint init_pending : 1;
-};
-
-struct _MonoGenericParam {
- MonoClass *pklass;
- MonoMethod *method;
- const char *name;
- guint16 flags;
- guint16 num;
- MonoClass** constraints; /* NULL means end of list */
-};
-
-#define mono_class_has_parent(klass,parent) ((klass)->idepth >= (parent)->idepth) && ((klass)->supertypes [(parent)->idepth - 1] == (parent))
-
-typedef struct {
- gulong new_object_count;
- gulong initialized_class_count;
- gulong used_class_count;
- gulong class_vtable_size;
- gulong class_static_data_size;
-} MonoStats;
-
-extern MonoStats mono_stats;
-
-typedef gpointer (*MonoTrampoline) (MonoMethod *method);
-
-typedef gpointer (*MonoLookupDynamicToken) (MonoImage *image, guint32 token);
-
-void
-mono_classes_init (void);
+ char* proxy_class_name;
+} MonoRemoteClass;
MonoClass *
mono_class_get (MonoImage *image, guint32 type_token);
-void
-mono_class_init (MonoClass *klass);
-
-void
-mono_class_layout_fields (MonoClass *klass);
+MonoClass *
+mono_class_get_full (MonoImage *image, guint32 type_token, MonoGenericContext *context);
void
-mono_class_setup_vtable (MonoClass *klass, MonoMethod **overrides, int onum);
+mono_class_init (MonoClass *klass);
MonoVTable *
mono_class_vtable (MonoDomain *domain, MonoClass *klass);
-MonoVTable *
-mono_class_proxy_vtable (MonoDomain *domain, MonoClass *klass);
-
-void
-mono_class_setup_mono_type (MonoClass *klass);
-
-void
-mono_class_setup_parent (MonoClass *klass, MonoClass *parent);
-
-void
-mono_class_setup_supertypes (MonoClass *klass);
-
MonoClass *
mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
MonoClass *
mono_class_from_typeref (MonoImage *image, guint32 type_token);
-gboolean
-mono_class_is_open_constructed_type (MonoType *t);
-
MonoClass *
mono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *image, gboolean is_mvar);
-MonoClass*
-mono_class_from_generic (MonoType *gtype, gboolean inflate_methods);
-
MonoType*
-mono_class_inflate_generic_type (MonoType *type, MonoGenericInst *ginst);
-
-MonoMethodSignature*
-mono_class_inflate_generic_signature (MonoImage *image, MonoMethodSignature *sig, MonoGenericInst *ginst);
+mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context);
MonoMethod*
-mono_class_inflate_generic_method (MonoMethod *method, MonoGenericInst *ginst);
-
-MonoClassField*
-mono_field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass);
+mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context, MonoClass *klass);
MonoClassField*
-mono_field_from_token (MonoImage *image, guint32 token, MonoClass **retklass);
+mono_field_from_token (MonoImage *image, guint32 token, MonoClass **retklass, MonoGenericContext *context);
-MonoMethod**
-mono_class_get_overrides (MonoImage *image, guint32 type_token, gint32 *num_overrides);
+MonoClass *
+mono_bounded_array_class_get (MonoClass *element_class, guint32 rank, gboolean bounded);
MonoClass *
mono_array_class_get (MonoClass *element_class, guint32 rank);
MonoClassField *
mono_class_get_field_from_name (MonoClass *klass, const char *name);
+guint32
+mono_class_get_field_token (MonoClassField *field);
+
+guint32
+mono_class_get_event_token (MonoEvent *event);
+
MonoProperty*
mono_class_get_property_from_name (MonoClass *klass, const char *name);
+guint32
+mono_class_get_property_token (MonoProperty *prop);
+
gint32
mono_array_element_size (MonoClass *ac);
gboolean
mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass);
-gboolean
-mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller);
-
gpointer
-mono_ldtoken (MonoImage *image, guint32 token, MonoClass **retclass);
+mono_ldtoken (MonoImage *image, guint32 token, MonoClass **retclass, MonoGenericContext *context);
char*
mono_type_get_name (MonoType *type);
-void
-mono_install_trampoline (MonoTrampoline func);
+char*
+mono_type_get_full_name (MonoType *type);
-void
-mono_install_remoting_trampoline (MonoTrampoline func);
+MonoType*
+mono_type_get_underlying_type (MonoType *type);
-gpointer
-mono_lookup_dynamic_token (MonoImage *image, guint32 token);
+/* MonoClass accessors */
+MonoImage*
+mono_class_get_image (MonoClass *klass);
-void
-mono_install_lookup_dynamic_token (MonoLookupDynamicToken func);
+MonoClass*
+mono_class_get_element_class (MonoClass *klass);
+
+gboolean
+mono_class_is_valuetype (MonoClass *klass);
+
+gboolean
+mono_class_is_enum (MonoClass *klass);
+
+MonoType*
+mono_class_enum_basetype (MonoClass *klass);
+
+MonoClass*
+mono_class_get_parent (MonoClass *klass);
+
+MonoClass*
+mono_class_get_nesting_type (MonoClass *klass);
+
+int
+mono_class_get_rank (MonoClass *klass);
+
+guint32
+mono_class_get_flags (MonoClass *klass);
+
+const char*
+mono_class_get_name (MonoClass *klass);
+
+const char*
+mono_class_get_namespace (MonoClass *klass);
+
+MonoType*
+mono_class_get_type (MonoClass *klass);
+
+MonoType*
+mono_class_get_byref_type (MonoClass *klass);
+
+int
+mono_class_num_fields (MonoClass *klass);
+
+int
+mono_class_num_methods (MonoClass *klass);
+
+int
+mono_class_num_properties (MonoClass *klass);
+
+int
+mono_class_num_events (MonoClass *klass);
+
+MonoClassField*
+mono_class_get_fields (MonoClass* klass, gpointer *iter);
+
+MonoMethod*
+mono_class_get_methods (MonoClass* klass, gpointer *iter);
+
+MonoProperty*
+mono_class_get_properties (MonoClass* klass, gpointer *iter);
+
+MonoEvent*
+mono_class_get_events (MonoClass* klass, gpointer *iter);
+
+MonoClass*
+mono_class_get_interfaces (MonoClass* klass, gpointer *iter);
+
+MonoClass*
+mono_class_get_nested_types (MonoClass* klass, gpointer *iter);
+
+/* MonoClassField accessors */
+const char*
+mono_field_get_name (MonoClassField *field);
+
+MonoType*
+mono_field_get_type (MonoClassField *field);
+
+MonoClass*
+mono_field_get_parent (MonoClassField *field);
+
+guint32
+mono_field_get_flags (MonoClassField *field);
+
+/* MonoProperty acessors */
+const char*
+mono_property_get_name (MonoProperty *prop);
+
+MonoMethod*
+mono_property_get_set_method (MonoProperty *prop);
+
+MonoMethod*
+mono_property_get_get_method (MonoProperty *prop);
+
+MonoClass*
+mono_property_get_parent (MonoProperty *prop);
+
+guint32
+mono_property_get_flags (MonoProperty *prop);
+
+/* MonoEvent accessors */
+const char*
+mono_event_get_name (MonoEvent *event);
+
+MonoMethod*
+mono_event_get_add_method (MonoEvent *event);
+
+MonoMethod*
+mono_event_get_remove_method (MonoEvent *event);
+
+MonoMethod*
+mono_event_get_remove_method (MonoEvent *event);
+
+MonoMethod*
+mono_event_get_raise_method (MonoEvent *event);
+
+MonoClass*
+mono_event_get_parent (MonoEvent *event);
+
+guint32
+mono_event_get_flags (MonoEvent *event);
-void
-mono_install_get_config_dir(void);
+MonoMethod *
+mono_class_get_method_from_name (MonoClass *klass, const char *name, int param_count);
#endif /* _MONO_CLI_CLASS_H_ */