2006-06-20 Martin Baulig <martin@ximian.com>
[mono.git] / mono / metadata / metadata-internals.h
index 23b0647a9db0fc6c27b825db4d808ff96c74d29d..e6cdf54e2516a66291f814aad3fc0cdbbbd9da22 100644 (file)
@@ -8,8 +8,17 @@
 #include "mono/metadata/domain-internals.h"
 #include "mono/utils/mono-hash.h"
 #include "mono/utils/mono-compiler.h"
+#include "mono/utils/monobitset.h"
 
 struct _MonoAssembly {
+       /* 
+        * The number of appdomains which have this assembly loaded plus the number of 
+        * assemblies referencing this assembly through an entry in their image->references
+        * arrays. The later is needed because entries in the image->references array
+        * might point to assemblies which are only loaded in some appdomains, and without
+        * the additional reference, they can be freed at any time.
+        * The ref_count is initially 0.
+        */
        int ref_count; /* use atomic operations only */
        char *basedir;
        MonoAssemblyName aname;
@@ -50,7 +59,15 @@ struct _MonoTableInfo {
        guint32   size_bitfield;
 };
 
+#define REFERENCE_MISSING ((gpointer) -1)
+
 struct _MonoImage {
+       /*
+        * The number of assemblies which reference this MonoImage though their 'image'
+        * field plus the number of images which reference this MonoImage through their 
+        * 'modules' field, plus the number of threads holding temporary references to
+        * this image between calls of mono_image_open () and mono_image_close ().
+        */
        int   ref_count;
        FILE *file_descr;
        /* if file_descr is NULL the image was loaded from raw data */
@@ -67,7 +84,7 @@ struct _MonoImage {
        char *name;
        const char *assembly_name;
        const char *module_name;
-       const char *version;
+       char *version;
        gint16 md_version_major, md_version_minor;
        char *guid;
        void *image_info;
@@ -122,16 +139,19 @@ struct _MonoImage {
        GHashTable *memberref_signatures;
        GHashTable *helper_signatures;
 
+       /* Indexed by blob heap indexes */
+       GHashTable *method_signatures;
+
        /*
         * Indexes namespaces to hash tables that map class name to typedef token.
         */
        GHashTable *name_cache;
 
        /*
-        * Indexed by ((rank << 24) | (typedef & 0xffffff)), which limits us to a
-        * maximal rank of 255
+        * Indexed by MonoClass
         */
        GHashTable *array_cache;
+       GHashTable *ptr_cache;
 
        /*
         * indexed by MonoMethodSignature 
@@ -150,6 +170,18 @@ struct _MonoImage {
        GHashTable *synchronized_cache;
        GHashTable *unbox_wrapper_cache;
 
+       /*
+        * indexed by MonoClass pointers
+        */
+       GHashTable *ldfld_wrapper_cache;
+       GHashTable *ldflda_wrapper_cache;
+       GHashTable *ldfld_remote_wrapper_cache;
+       GHashTable *stfld_wrapper_cache;
+       GHashTable *stfld_remote_wrapper_cache;
+       GHashTable *isinst_cache;
+       GHashTable *castclass_cache;
+       GHashTable *proxy_isinst_cache;
+
        void *reflection_info;
 
        /*
@@ -160,6 +192,9 @@ struct _MonoImage {
 
        /* dll map entries */
        GHashTable *dll_map;
+
+       /* interfaces IDs from this image */
+       MonoBitSet *interface_bitset;
 };
 
 enum {
@@ -271,6 +306,9 @@ struct _MonoMethodHeader {
 /* for use with allocated memory blocks (assumes alignment is to 8 bytes) */
 guint mono_aligned_addr_hash (gconstpointer ptr) MONO_INTERNAL;
 
+void
+mono_metadata_cleanup (void);
+
 const char *   mono_meta_table_name              (int table) MONO_INTERNAL;
 void           mono_metadata_compute_table_bases (MonoImage *meta) MONO_INTERNAL;
 
@@ -312,6 +350,8 @@ mono_metadata_parse_mh_full                 (MonoImage             *image,
                                             MonoGenericContainer  *container,
                                             const char            *ptr);
 
+int* mono_metadata_get_param_attrs          (MonoImage *m, int def);
+
 guint
 mono_metadata_generic_method_hash           (MonoGenericMethod     *gmethod) MONO_INTERNAL;
 
@@ -349,5 +389,7 @@ mono_assembly_name_parse_full                    (const char           *name,
 
 guint32 mono_metadata_get_generic_param_row (MonoImage *image, guint32 token, guint32 *owner);
 
+void mono_unload_interface_ids (MonoBitSet *bitset) MONO_INTERNAL;
+
 #endif /* __MONO_METADATA_INTERNALS_H__ */