[runtime] Make the image->gsharedvt_types into an array.
authorZoltan Varga <vargaz@gmail.com>
Tue, 10 Mar 2015 00:57:25 +0000 (20:57 -0400)
committerZoltan Varga <vargaz@gmail.com>
Tue, 10 Mar 2015 00:57:32 +0000 (20:57 -0400)
mono/metadata/image.c
mono/metadata/metadata-internals.h
mono/mini/mini-runtime.c

index 33c389cb4bfb373c7124fd571e9b5580ad511f0d..7c7632c3732e287f63801ed77c0d32b990bebb6b 100644 (file)
@@ -1652,7 +1652,9 @@ mono_image_close_except_pools (MonoImage *image)
        free_hash (image->native_wrapper_aot_cache);
        free_hash (image->pinvoke_scopes);
        free_hash (image->pinvoke_scope_filenames);
-       free_hash (image->gsharedvt_types);
+       for (i = 0; i < image->gshared_types_len; ++i)
+               free_hash (image->gshared_types [i]);
+       g_free (image->gshared_types);
 
        /* The ownership of signatures is not well defined */
        g_hash_table_destroy (image->memberref_signatures);
index 219276d2d7b268d399347a09110eed97c9090fcd..cc8faab15be85bf54774b0df1f181734487907ee 100644 (file)
@@ -339,7 +339,9 @@ struct _MonoImage {
        GHashTable *pinvoke_scope_filenames;
 
        /* Indexed by MonoGenericParam pointers */
-       GHashTable *gsharedvt_types;
+       GHashTable **gshared_types;
+       /* The length of the above array */
+       int gshared_types_len;
 
        /*
         * No other runtime locks must be taken while holding this lock.
index 7e383ea1ae1493bfc3582de7611f38708c8e5e41..3c1acca4c77c45e0d72f440bce5a2eb27a34018d 100755 (executable)
@@ -1678,9 +1678,11 @@ get_gsharedvt_type (MonoType *t)
                image = par->owner->image;
 
                mono_image_lock (image);
-               if (!image->gsharedvt_types)
-                       image->gsharedvt_types = g_hash_table_new (NULL, NULL);
-               res = g_hash_table_lookup (image->gsharedvt_types, par);
+               if (!image->gshared_types) {
+                       image->gshared_types_len = 1;
+                       image->gshared_types [0] = g_hash_table_new (NULL, NULL);
+               }
+               res = g_hash_table_lookup (image->gshared_types [0], par);
                mono_image_unlock (image);
                if (res)
                        return res;
@@ -1699,7 +1701,7 @@ get_gsharedvt_type (MonoType *t)
        if (par->owner) {
                mono_image_lock (image);
                /* Duplicates are ok */
-               g_hash_table_insert (image->gsharedvt_types, par, res);
+               g_hash_table_insert (image->gshared_types [0], par, res);
                mono_image_unlock (image);
        }