Merge pull request #2175 from xmcclure/pre-image-audit
[mono.git] / mono / metadata / metadata-internals.h
index 27098c333868682a1010a36b4b4c223fcb56ff1f..57f9376738fef1c694b5e36db78c39c685612efa 100644 (file)
@@ -74,7 +74,7 @@ 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
+        * arrays. The latter 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.
@@ -180,6 +180,8 @@ struct _MonoImage {
         * this image between calls of mono_image_open () and mono_image_close ().
         */
        int   ref_count;
+
+       /* If the raw data was allocated from a source such as mmap, the allocator may store resource tracking information here. */
        void *raw_data_handle;
        char *raw_data;
        guint32 raw_data_len;
@@ -216,10 +218,16 @@ struct _MonoImage {
 
        /* Whenever this image is considered as platform code for the CoreCLR security model */
        guint8 core_clr_platform_code : 1;
-                           
+
+       /* The path to the file for this image. */
        char *name;
+
+       /* The assembly name reported in the file for this image (expected to be NULL for a netmodule) */
        const char *assembly_name;
+
+       /* The module name reported in the file for this image (could be NULL for a malformed file) */
        const char *module_name;
+
        char *version;
        gint16 md_version_major, md_version_minor;
        char *guid;
@@ -249,11 +257,16 @@ struct _MonoImage {
        MonoAssembly **references;
        int nreferences;
 
+       /* Code files in the assembly. */
        MonoImage **modules;
        guint32 module_count;
        gboolean *modules_loaded;
 
-       MonoImage **files; /*protected by the image lock*/
+       /*
+        * 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;
 
        gpointer aot_module;
 
@@ -432,6 +445,7 @@ typedef struct {
        guint32 *values; /* rows * columns */
 } MonoDynamicTable;
 
+/* "Dynamic" assemblies and images arise from System.Reflection.Emit */
 struct _MonoDynamicAssembly {
        MonoAssembly assembly;
        char *strong_name;