Merge pull request #4033 from ntherning/no-stdcall-for-icalls-on-windows-32-bit
[mono.git] / mono / metadata / class-internals.h
index 0c14ec3b04236557fbc37d94da1ab3f042768355..5ff799cc626c810b7ccb58c4a6c4f8da2c4170c4 100644 (file)
@@ -9,6 +9,7 @@
 #include <mono/metadata/object.h>
 #include <mono/metadata/mempool.h>
 #include <mono/metadata/metadata-internals.h>
+#include <mono/metadata/property-bag.h>
 #include <mono/io-layer/io-layer.h>
 #include "mono/utils/mono-compiler.h"
 #include "mono/utils/mono-error.h"
@@ -164,6 +165,8 @@ typedef struct {
 } MonoMarshalField;
 
 typedef struct {
+       MonoPropertyBagItem head;
+
        guint32 native_size, min_align;
        guint32 num_fields;
        MonoMethod *ptr_to_str;
@@ -224,37 +227,21 @@ typedef struct {
 
 #define MONO_SIZEOF_CLASS_RUNTIME_INFO (sizeof (MonoClassRuntimeInfo) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
 
-#define MONO_CLASS_PROP_EXCEPTION_DATA 0
-
-/* 
- * This structure contains the rarely used fields of MonoClass
- * Since using just one field causes the whole structure to be allocated, it should
- * be used for fields which are only used in like 5% of all classes.
- */
 typedef struct {
-       struct {
-#if MONO_SMALL_CONFIG
-               guint16 first, count;
-#else
-               guint32 first, count;
-#endif
-       } property, event;
+       MonoPropertyBagItem head;
 
-       /* Initialized by a call to mono_class_setup_properties () */
        MonoProperty *properties;
+       guint32 first, count;
+       MonoFieldDefaultValue *def_values;
+} MonoClassPropertyInfo;
+
+typedef struct {
+       MonoPropertyBagItem head;
 
        /* Initialized by a call to mono_class_setup_events () */
        MonoEvent *events;
-
-       guint32    declsec_flags;       /* declarative security attributes flags */
-
-       /* Default values/RVA for fields and properties */
-       /* Accessed using mono_class_get_field_default_value () / mono_field_get_data () */
-       MonoFieldDefaultValue *field_def_values;
-       MonoFieldDefaultValue *prop_def_values;
-
-       GList      *nested_classes;
-} MonoClassExt;
+       guint32 first, count;
+} MonoClassEventInfo;
 
 typedef enum {
        MONO_CLASS_DEF = 1, /* non-generic type */
@@ -297,6 +284,8 @@ struct _MonoClass {
        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 */
+       guint is_array_special_interface : 1; /* gtd or ginst of once of the magic interfaces that arrays implement */
+
        /* next byte */
        guint8 min_align;
 
@@ -329,7 +318,7 @@ struct _MonoClass {
        guint simd_type : 1; /* class is a simd intrinsic type */
        guint has_finalize_inited    : 1; /* has_finalize is initialized */
        guint fields_inited : 1; /* setup_fields () has finished */
-       guint has_failure : 1; /* See MONO_CLASS_PROP_EXCEPTION_DATA for a MonoErrorBoxed with the details */
+       guint has_failure : 1; /* See mono_class_get_exception_data () for a MonoErrorBoxed with the details */
 
        MonoClass  *parent;
        MonoClass  *nested_in;
@@ -362,30 +351,6 @@ struct _MonoClass {
                int generic_param_token; /* for generic param types, both var and mvar */
        } sizes;
 
-       /*
-        * From the TypeDef table
-        */
-       struct {
-#if MONO_SMALL_CONFIG
-               guint16 count;
-#else
-               guint32 count;
-#endif
-       } field;
-       struct {
-#if MONO_SMALL_CONFIG
-               guint16 count;
-#else
-               guint32 count;
-#endif
-       } method;
-
-       /* A GC handle pointing to the corresponding type builder/generic param builder */
-       guint32 ref_info_handle;
-
-       /* loaded on demand */
-       MonoMarshalType *marshal_info;
-
        /*
         * Field information: Type and location from object base
         */
@@ -404,8 +369,8 @@ struct _MonoClass {
        /* Generic vtable. Initialized by a call to mono_class_setup_vtable () */
        MonoMethod **vtable;
 
-       /* Rarely used fields of classes */
-       MonoClassExt *ext;
+       /* Infrequently used items. See class-accessors.c: InfrequentDataKind for what goes into here. */
+       MonoPropertyBag infrequent_data;
 };
 
 typedef struct {
@@ -416,6 +381,7 @@ typedef struct {
         */
        guint32 first_method_idx;
        guint32 first_field_idx;
+       guint32 method_count, field_count;
        /* next element in the class_cache hash list (in MonoImage) */
        MonoClass *next_class_cache;
 } MonoClassDef;
@@ -436,6 +402,7 @@ typedef struct {
 
 typedef struct {
        MonoClass class;
+       guint32 method_count;
 } MonoClassArray;
 
 typedef struct {
@@ -926,9 +893,6 @@ typedef struct {
 
 extern MonoStats mono_stats;
 
-typedef gpointer (*MonoRemotingTrampoline)       (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target, MonoError *error);
-typedef gpointer (*MonoDelegateTrampoline)       (MonoDomain *domain, MonoClass *klass);
-
 typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
 
 typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
@@ -1016,9 +980,6 @@ mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_typ
 const char*
 mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def_type);
 
-void
-mono_install_delegate_trampoline (MonoDelegateTrampoline func);
-
 gpointer
 mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error);
 
@@ -1160,9 +1121,6 @@ typedef struct {
 MonoRemoteClass*
 mono_remote_class (MonoDomain *domain, MonoString *class_name, MonoClass *proxy_class, MonoError *error);
 
-void
-mono_install_remoting_trampoline (MonoRemotingTrampoline func);
-
 #define mono_class_is_transparent_proxy(klass) ((klass) == mono_defaults.transparent_proxy_class)
 #define mono_class_is_real_proxy(klass) ((klass) == mono_defaults.real_proxy_class)
 #define mono_object_is_transparent_proxy(object) (((MonoObject*)object)->vtable->klass == mono_defaults.transparent_proxy_class)
@@ -1336,6 +1294,9 @@ mono_type_is_valid_enum_basetype (MonoType * type);
 MONO_API gboolean
 mono_class_is_valid_enum (MonoClass *klass);
 
+gboolean
+mono_type_is_primitive (MonoType *type);
+
 MonoType *
 mono_type_get_checked        (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
 
@@ -1384,9 +1345,6 @@ mono_class_alloc (MonoClass *klass, int size);
 gpointer
 mono_class_alloc0 (MonoClass *klass, int size);
 
-void
-mono_class_alloc_ext (MonoClass *klass);
-
 void
 mono_class_setup_interfaces (MonoClass *klass, MonoError *error);
 
@@ -1498,6 +1456,66 @@ mono_class_get_first_field_idx (MonoClass *klass);
 void
 mono_class_set_first_field_idx (MonoClass *klass, guint32 idx);
 
+guint32
+mono_class_get_method_count (MonoClass *klass);
+
+void
+mono_class_set_method_count (MonoClass *klass, guint32 count);
+
+guint32
+mono_class_get_field_count (MonoClass *klass);
+
+void
+mono_class_set_field_count (MonoClass *klass, guint32 count);
+
+MonoMarshalType*
+mono_class_get_marshal_info (MonoClass *class);
+
+void
+mono_class_set_marshal_info (MonoClass *class, MonoMarshalType *marshal_info);
+
+guint32
+mono_class_get_ref_info_handle (MonoClass *class);
+
+guint32
+mono_class_set_ref_info_handle (MonoClass *class, guint32 value);
+
+MonoErrorBoxed*
+mono_class_get_exception_data (MonoClass *klass);
+
+void
+mono_class_set_exception_data (MonoClass *klass, MonoErrorBoxed *value);
+
+GList*
+mono_class_get_nested_classes_property (MonoClass *klass);
+
+void
+mono_class_set_nested_classes_property (MonoClass *klass, GList *value);
+
+MonoClassPropertyInfo*
+mono_class_get_property_info (MonoClass *klass);
+
+void
+mono_class_set_property_info (MonoClass *klass, MonoClassPropertyInfo *info);
+
+MonoClassEventInfo*
+mono_class_get_event_info (MonoClass *klass);
+
+void
+mono_class_set_event_info (MonoClass *klass, MonoClassEventInfo *info);
+
+MonoFieldDefaultValue*
+mono_class_get_field_def_values (MonoClass *klass);
+
+void
+mono_class_set_field_def_values (MonoClass *klass, MonoFieldDefaultValue *values);
+
+guint32
+mono_class_get_declsec_flags (MonoClass *class);
+
+void
+mono_class_set_declsec_flags (MonoClass *class, guint32 value);
+
 /*Now that everything has been defined, let's include the inline functions */
 #include <mono/metadata/class-inlines.h>