2008-07-28 Marek Habersack <mhabersack@novell.com>
[mono.git] / mono / metadata / class-internals.h
index 7c8babcfcb64429b5b72696f169db9a0b5a80dc3..54d5f3a0f424c6b114400747c3ecfe56810c61c2 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <mono/metadata/class.h>
 #include <mono/metadata/object.h>
+#include <mono/metadata/mempool.h>
 #include <mono/io-layer/io-layer.h>
 #include "mono/utils/mono-compiler.h"
 
@@ -21,6 +22,13 @@ typedef struct _MonoMethodWrapper MonoMethodWrapper;
 typedef struct _MonoMethodInflated MonoMethodInflated;
 typedef struct _MonoMethodPInvoke MonoMethodPInvoke;
 
+/* Properties that applies to a group of structs should better use a higher number
+ * to avoid colision with type specific properties.
+ * 
+ * This prop applies to class, method, property, event, assembly and image.
+ */
+#define MONO_PROP_DYNAMIC_CATTR 0x1000
+
 typedef enum {
 #define WRAPPER(e,n) MONO_WRAPPER_ ## e,
 #include "wrapper-types.h"
@@ -186,7 +194,8 @@ enum {
        MONO_EXCEPTION_METHOD_ACCESS = 9,
        MONO_EXCEPTION_FIELD_ACCESS = 10,
        MONO_EXCEPTION_GENERIC_SHARING_FAILED = 11,
-       MONO_EXCEPTION_BAD_IMAGE = 12
+       MONO_EXCEPTION_BAD_IMAGE = 12,
+       MONO_EXCEPTION_OBJECT_SUPPLIED = 13 /*The exception object is already created.*/
        /* add other exception type */
 };
 
@@ -207,7 +216,8 @@ enum {
        MONO_RGCTX_INFO_REFLECTION_TYPE,
        MONO_RGCTX_INFO_METHOD,
        MONO_RGCTX_INFO_GENERIC_METHOD_CODE,
-       MONO_RGCTX_INFO_CLASS_FIELD
+       MONO_RGCTX_INFO_CLASS_FIELD,
+       MONO_RGCTX_INFO_METHOD_RGCTX
 };
 
 typedef struct _MonoRuntimeGenericContextOtherInfoTemplate {
@@ -219,8 +229,21 @@ typedef struct _MonoRuntimeGenericContextOtherInfoTemplate {
 typedef struct {
        MonoClass *next_subclass;
        MonoRuntimeGenericContextOtherInfoTemplate *other_infos;
+       GSList *method_templates;
 } MonoRuntimeGenericContextTemplate;
 
+typedef struct {
+       MonoVTable *class_vtable; /* must be the first element */
+       MonoGenericInst *method_inst;
+       gpointer infos [MONO_ZERO_LEN_ARRAY];
+} MonoMethodRuntimeGenericContext;
+
+#define MONO_RGCTX_SLOT_MAKE_RGCTX(i)  (i)
+#define MONO_RGCTX_SLOT_MAKE_MRGCTX(i) ((i) | 0x80000000)
+#define MONO_RGCTX_SLOT_INDEX(s)       ((s) & 0x7fffffff)
+#define MONO_RGCTX_SLOT_IS_MRGCTX(s)   (((s) & 0x80000000) ? TRUE : FALSE)
+
+
 #define MONO_CLASS_PROP_EXCEPTION_DATA 0
 
 struct _MonoClass {
@@ -624,6 +647,7 @@ typedef struct {
 
 enum {
        MONO_GENERIC_SHARING_NONE,
+       MONO_GENERIC_SHARING_COLLECTIONS,
        MONO_GENERIC_SHARING_CORLIB,
        MONO_GENERIC_SHARING_ALL
 };
@@ -703,6 +727,9 @@ mono_class_get_finalizer (MonoClass *klass) MONO_INTERNAL;
 gboolean
 mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller) MONO_INTERNAL;
 
+gboolean
+mono_class_field_is_special_static (MonoClassField *field) MONO_INTERNAL;
+
 gboolean
 mono_class_has_special_static_fields (MonoClass *klass) MONO_INTERNAL;
 
@@ -770,6 +797,9 @@ mono_method_inflated_lookup (MonoMethodInflated* method, gboolean cache) MONO_IN
 MonoMethodSignature *
 mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericContext *context);
 
+MonoType*
+mono_class_inflate_generic_type_with_mempool (MonoMemPool *mempool, MonoType *type, MonoGenericContext *context) MONO_INTERNAL;
+
 void
 mono_metadata_free_inflated_signature (MonoMethodSignature *sig);
 
@@ -919,6 +949,9 @@ mono_find_jit_icall_by_name (const char *name) MONO_INTERNAL;
 MonoJitICallInfo *
 mono_find_jit_icall_by_addr (gconstpointer addr) MONO_INTERNAL;
 
+GHashTable*
+mono_get_jit_icall_info (void) MONO_INTERNAL;
+
 gboolean
 mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data) MONO_INTERNAL;
 
@@ -934,8 +967,8 @@ mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format) MONO_INTERNA
 char*
 mono_type_get_full_name (MonoClass *class) MONO_INTERNAL;
 
-MonoArrayType *mono_dup_array_type (MonoArrayType *a) MONO_INTERNAL;
-MonoMethodSignature *mono_metadata_signature_deep_dup (MonoMethodSignature *sig) MONO_INTERNAL;
+MonoArrayType *mono_dup_array_type (MonoMemPool *mp, MonoArrayType *a) MONO_INTERNAL;
+MonoMethodSignature *mono_metadata_signature_deep_dup (MonoMemPool *mp, MonoMethodSignature *sig) MONO_INTERNAL;
 
 void
 mono_image_init_name_cache (MonoImage *image);
@@ -962,6 +995,12 @@ mono_type_get_full        (MonoImage *image, guint32 type_token, MonoGenericCont
 gboolean
 mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass) MONO_INTERNAL;
 
+MonoMethod*
+mono_method_get_declaring_generic_method (MonoMethod *method) MONO_INTERNAL;
+
+MonoMethod*
+mono_class_get_method_generic (MonoClass *klass, MonoMethod *method) MONO_INTERNAL;
+
 MonoType*
 mono_type_get_basic_type_from_generic (MonoType *type) MONO_INTERNAL;
 
@@ -971,11 +1010,18 @@ mono_class_generic_sharing_enabled (MonoClass *class) MONO_INTERNAL;
 gpointer
 mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot) MONO_INTERNAL;
 
+gpointer
+mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint32 slot) MONO_INTERNAL;
+
+MonoMethodRuntimeGenericContext*
+mono_method_lookup_rgctx (MonoVTable *class_vtable, MonoGenericInst *method_inst) MONO_INTERNAL;
+
 int
-mono_class_rgctx_get_array_size (int n) MONO_INTERNAL;
+mono_class_rgctx_get_array_size (int n, gboolean mrgctx) MONO_INTERNAL;
 
-gboolean
-mono_class_lookup_or_register_other_info (MonoClass *class, gpointer data, int info_type, MonoGenericContext *generic_context) MONO_INTERNAL;
+guint32
+mono_method_lookup_or_register_other_info (MonoMethod *method, gboolean in_mrgctx, gpointer data,
+       int info_type, MonoGenericContext *generic_context) MONO_INTERNAL;
 
 int
 mono_generic_context_check_used (MonoGenericContext *context) MONO_INTERNAL;
@@ -992,4 +1038,7 @@ mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, Mono
 gboolean
 mono_method_can_access_field_full (MonoMethod *method, MonoClassField *field, MonoClass *context_klass) MONO_INTERNAL;
 
+MonoClass *
+mono_class_get_generic_type_definition (MonoClass *klass) MONO_INTERNAL;
+
 #endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */