In mono/metadata:
authorBen Maurer <benm@mono-cvs.ximian.com>
Sat, 12 Feb 2005 16:54:34 +0000 (16:54 -0000)
committerBen Maurer <benm@mono-cvs.ximian.com>
Sat, 12 Feb 2005 16:54:34 +0000 (16:54 -0000)
2005-02-12  Ben Maurer  <bmaurer@ximian.com>
* domain-internals.h: add the hashtable here.

* class-internals.h: Remove `info' from MonoMethod

* domain.c: Add a new hashtable, jit_trampoline_hash

In mono/mini:
2005-02-12  Ben Maurer  <bmaurer@ximian.com>
* mini.c, driver.c: Use the new jit trampoline hashtable

svn path=/trunk/mono/; revision=40540

mono/metadata/ChangeLog
mono/metadata/class-internals.h
mono/metadata/domain-internals.h
mono/metadata/domain.c
mono/mini/ChangeLog
mono/mini/driver.c
mono/mini/mini.c

index f2b420ba01e149278f5628e1a14ce29226f161c7..f884dc5afae09af5be19e34276a36ae70785ab27 100644 (file)
@@ -1,3 +1,10 @@
+2005-02-12  Ben Maurer  <bmaurer@ximian.com>
+
+       * domain-internals.h: add the hashtable here.
+
+       * class-internals.h: Remove `info' from MonoMethod
+
+       * domain.c: Add a new hashtable, jit_trampoline_hash
 
 Fri Feb 11 17:11:20 CET 2005 Paolo Molaro <lupus@ximian.com>
 
index c389b60db655220213b902716bf2b2e73a3af1fa..f1c008bd7c293a2890c17752ead6ee46a4b060b7 100644 (file)
@@ -57,7 +57,6 @@ struct _MonoMethod {
        guint32 token;
        MonoClass *klass;
        MonoMethodSignature *signature;
-       gpointer info; /* runtime info */
        /* name is useful mostly for debugging */
        const char *name;
        /* this is used by the inlining algorithm */
index d5b2440226984c9f7c1c7f17b80ead49191909f8..749105924c3d8d9b7898fc3f538aaf2fe01d91df 100644 (file)
@@ -122,6 +122,7 @@ struct _MonoDomain {
        GHashTable         *jump_target_hash;
        GHashTable         *class_init_trampoline_hash;
        GHashTable         *jump_trampoline_hash;
+       GHashTable         *jit_trampoline_hash;
        /* 
         * This must be a GHashTable, since these objects can't be finalized
         * if the hashtable contains a GC visible reference to them.
index fae5fcd0878ea2720e1d40047b1407029badc8b3..3d1d485965bfbaa14e8425c8f417e102559fe30b 100644 (file)
@@ -262,6 +262,7 @@ mono_domain_create (void)
        domain->class_init_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
        domain->jump_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
        domain->finalizable_objects_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
+       domain->jit_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
        domain->domain_id = InterlockedIncrement (&appdomain_id_counter);
 
        InitializeCriticalSection (&domain->lock);
@@ -820,6 +821,8 @@ mono_domain_free (MonoDomain *domain, gboolean force)
        domain->jump_trampoline_hash = NULL;
        g_hash_table_destroy (domain->finalizable_objects_hash);
        domain->finalizable_objects_hash = NULL;
+       g_hash_table_destroy (domain->jit_trampoline_hash);
+       domain->jit_trampoline_hash = NULL;
        if (domain->special_static_fields) {
                g_hash_table_destroy (domain->special_static_fields);
                domain->special_static_fields = NULL;
index 13b13d68fb4c30e62f4c3da9c95fc5c25fc8f54d..f61fc591053122bcf2abecaa8382c3a6a562b3e0 100644 (file)
@@ -1,3 +1,6 @@
+2005-02-12  Ben Maurer  <bmaurer@ximian.com>
+
+       * mini.c, driver.c: Use the new jit trampoline hashtable
 
 Fri Feb 11 18:47:11 CET 2005 Paolo Molaro <lupus@ximian.com>
 
index 681b204614534c05b5fb0f2ac0aced033f81f84a..34b7d4ea398d51a6b535ec443e77377f15db82f3 100644 (file)
@@ -303,10 +303,8 @@ mini_regression (MonoImage *image, int verbose, int *total_run) {
                comp_time = elapsed = 0.0;
 
                /* fixme: ugly hack - delete all previously compiled methods */
-               for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
-                       method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
-                       method->info = NULL;
-               }
+               g_hash_table_destroy (mono_domain_get ()->jit_trampoline_hash);
+               mono_domain_get ()->jit_trampoline_hash = g_hash_table_new (mono_aligned_addr_hash, NULL);
 
                g_timer_start (timer);
                if (mini_stats_fd)
index a1072016200251c13b3489f43ccac88c817fa052..4784acc6394da1f8681d48bd0cd420736bb6b5a5 100644 (file)
@@ -6796,16 +6796,20 @@ mono_create_jit_trampoline (MonoMethod *method)
        MonoDomain *domain = mono_domain_get ();
        gpointer tramp;
 
-       /* Trampoline are domain specific, so cache only the one used in the root domain */
-       if ((domain == mono_get_root_domain ()) && method->info)
-               return method->info;
+       mono_domain_lock (domain);
+       tramp = g_hash_table_lookup (domain->jit_trampoline_hash, method);
+       mono_domain_unlock (domain);
+       if (tramp)
+               return tramp;
 
        if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
                return mono_create_jit_trampoline (mono_marshal_get_synchronized_wrapper (method));
 
        tramp = mono_arch_create_jit_trampoline (method);
-       if (domain == mono_get_root_domain ())
-               method->info = tramp;
+       
+       mono_domain_lock (domain);
+       g_hash_table_insert (domain->jit_trampoline_hash, method, tramp);
+       mono_domain_unlock (domain);
 
        mono_jit_stats.method_trampolines++;