Merge pull request #4621 from alexanderkyte/strdup_env
[mono.git] / mono / metadata / metadata-internals.h
index ba5f9d72e1aa81d635a3e6e5d1d1979da9985620..3ed3136236cc98661bb1758e92879596222f332a 100644 (file)
@@ -1,3 +1,6 @@
+/**
+ * \file
+ */
 
 #ifndef __MONO_METADATA_INTERNALS_H__
 #define __MONO_METADATA_INTERNALS_H__
@@ -175,10 +178,12 @@ typedef struct {
 
 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 ().
+        * This count is incremented during these situations:
+        *   - An assembly references this MonoImage though its 'image' field
+        *   - This MonoImage is present in the 'files' field of an image
+        *   - This MonoImage is present in the 'modules' field of an image
+        *   - A thread is holding a temporary reference to this MonoImage between
+        *     calls to mono_image_open and mono_image_close ()
         */
        int   ref_count;
 
@@ -210,6 +215,9 @@ struct _MonoImage {
        /* Whenever this image contains metadata only without PE data */
        guint8 metadata_only : 1;
 
+       /*  Whether this image belongs to load-from context */
+       guint8 load_from_context: 1;
+
        guint8 checked_module_cctor : 1;
        guint8 has_module_cctor : 1;
 
@@ -246,6 +254,10 @@ struct _MonoImage {
                            
        const char          *tables_base;
 
+       /* For PPDB files */
+       guint64 referenced_tables;
+       int *referenced_table_rows;
+
        /**/
        MonoTableInfo        tables [MONO_TABLE_NUM];
 
@@ -258,19 +270,21 @@ struct _MonoImage {
        MonoAssembly **references;
        int nreferences;
 
-       /* Code files in the assembly. */
+       /* Code files in the assembly. The main assembly has a "file" table and also a "module"
+        * table, where the module table is a subset of the file table. We track both lists,
+        * and because we can lazy-load them at different times we reference-increment both.
+        */
        MonoImage **modules;
        guint32 module_count;
        gboolean *modules_loaded;
 
-       /*
-        * Files in the assembly. Items are either NULL or alias items in modules, so this does not impact ref_count.
-        * Protected by the image lock.
-        */
        MonoImage **files;
+       guint32 file_count;
 
        gpointer aot_module;
 
+       guint8 aotid[16];
+
        /*
         * The Assembly this image was loaded from.
         */
@@ -334,6 +348,8 @@ struct _MonoImage {
        GHashTable *ldflda_wrapper_cache;
        GHashTable *stfld_wrapper_cache;
        GHashTable *isinst_cache;
+
+       GHashTable *icall_wrapper_cache;
        GHashTable *castclass_cache;
        GHashTable *proxy_isinst_cache;
        GHashTable *rgctx_template_hash; /* LOCKING: templates lock */
@@ -493,7 +509,6 @@ struct _MonoDynamicImage {
        GHashTable *method_aux_hash;
        GHashTable *vararg_aux_hash;
        MonoGHashTable *generic_def_objects;
-       MonoGHashTable *methodspec;
        /*
         * Maps final token values to the object they describe.
         */
@@ -633,6 +648,12 @@ mono_image_alloc0 (MonoImage *image, guint size);
 char*
 mono_image_strdup (MonoImage *image, const char *s);
 
+char*
+mono_image_strdup_vprintf (MonoImage *image, const char *format, va_list args);
+
+char*
+mono_image_strdup_printf (MonoImage *image, const char *format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);;
+
 GList*
 g_list_prepend_image (MonoImage *image, GList *list, gpointer data);
 
@@ -764,6 +785,9 @@ MonoGenericInst *
 mono_metadata_get_generic_inst              (int                   type_argc,
                                             MonoType             **type_argv);
 
+MonoGenericInst *
+mono_metadata_get_canonical_generic_inst    (MonoGenericInst *candidate);
+
 MonoGenericClass *
 mono_metadata_lookup_generic_class          (MonoClass            *gclass,
                                             MonoGenericInst       *inst,
@@ -800,6 +824,10 @@ mono_assembly_name_parse_full                   (const char           *name,
                                              gboolean *is_version_defined,
                                                  gboolean *is_token_defined);
 
+gboolean
+mono_assembly_fill_assembly_name_full (MonoImage *image, MonoAssemblyName *aname, gboolean copyBlobs);
+
+
 MONO_API guint32 mono_metadata_get_generic_param_row (MonoImage *image, guint32 token, guint32 *owner);
 
 void mono_unload_interface_ids (MonoBitSet *bitset);
@@ -906,5 +934,14 @@ mono_image_set_description (MonoImageSet *);
 MonoImageSet *
 mono_find_image_set_owner (void *ptr);
 
+void
+mono_loader_register_module (const char *name, MonoDl *module);
+
+gboolean
+mono_assembly_is_problematic_version (const char *name, guint16 major, guint16 minor, guint16 build, guint16 revision);
+
+void
+mono_ginst_get_desc (GString *str, MonoGenericInst *ginst);
+
 #endif /* __MONO_METADATA_INTERNALS_H__ */