2008-02-26 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / metadata / image.c
index d35eb58ed7d60ab6a017eb0111a8bcc1e67ce645..ab03895ee7c68ebd2d80900306557d9db92ecb28 100644 (file)
@@ -599,6 +599,7 @@ mono_image_init (MonoImage *image)
                g_hash_table_new ((GHashFunc)mono_signature_hash, 
                                  (GCompareFunc)mono_metadata_signature_equal);
        
+       image->runtime_invoke_direct_cache = g_hash_table_new (mono_aligned_addr_hash, NULL);
        image->managed_wrapper_cache = g_hash_table_new (mono_aligned_addr_hash, NULL);
        image->native_wrapper_cache = g_hash_table_new (mono_aligned_addr_hash, NULL);
        image->remoting_invoke_cache = g_hash_table_new (mono_aligned_addr_hash, NULL);
@@ -874,7 +875,7 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
 
        if ((filed = fopen (fname, "rb")) == NULL){
                if (IS_PORTABILITY_SET) {
-                       gchar *ffname = mono_portability_find_file (fname, FALSE);
+                       gchar *ffname = mono_portability_find_file (fname, TRUE);
                        if (ffname) {
                                filed = fopen (ffname, "rb");
                                g_free (ffname);
@@ -1271,9 +1272,12 @@ mono_image_close (MonoImage *image)
        g_hash_table_destroy (image->delegate_begin_invoke_cache);
        g_hash_table_destroy (image->delegate_end_invoke_cache);
        g_hash_table_destroy (image->delegate_invoke_cache);
+       if (image->delegate_abstract_invoke_cache)
+               g_hash_table_destroy (image->delegate_abstract_invoke_cache);
        g_hash_table_foreach (image->remoting_invoke_cache, free_remoting_wrappers, NULL);
        g_hash_table_destroy (image->remoting_invoke_cache);
        g_hash_table_destroy (image->runtime_invoke_cache);
+       g_hash_table_destroy (image->runtime_invoke_direct_cache);
        g_hash_table_destroy (image->synchronized_cache);
        g_hash_table_destroy (image->unbox_wrapper_cache);
        g_hash_table_destroy (image->cominterop_invoke_cache);
@@ -1295,6 +1299,15 @@ mono_image_close (MonoImage *image)
        g_hash_table_destroy (image->helper_signatures);
        g_hash_table_destroy (image->method_signatures);
 
+       if (image->generic_class_cache)
+               g_hash_table_destroy (image->generic_class_cache);
+
+       if (image->rgctx_template_hash)
+               g_hash_table_destroy (image->rgctx_template_hash);
+
+       if (image->generic_class_open_instances_hash)
+               g_hash_table_destroy (image->generic_class_open_instances_hash);
+
        if (image->interface_bitset) {
                mono_unload_interface_ids (image->interface_bitset);
                mono_bitset_free (image->interface_bitset);
@@ -1727,6 +1740,12 @@ mono_image_get_public_key (MonoImage *image, guint32 *size)
 {
        const char *pubkey;
        guint32 len, tok;
+
+       if (image->dynamic) {
+               if (size)
+                       *size = ((MonoDynamicImage*)image)->public_key_len;
+               return (char*)((MonoDynamicImage*)image)->public_key;
+       }
        if (image->tables [MONO_TABLE_ASSEMBLY].rows != 1)
                return NULL;
        tok = mono_metadata_decode_row_col (&image->tables [MONO_TABLE_ASSEMBLY], 0, MONO_ASSEMBLY_PUBLIC_KEY);