2003-12-03 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Wed, 3 Dec 2003 13:54:15 +0000 (13:54 -0000)
committerZoltan Varga <vargaz@gmail.com>
Wed, 3 Dec 2003 13:54:15 +0000 (13:54 -0000)
* mini.c (mono_find_jit_opcode_emulation): Turn emul_opcode_hash into
an array for better performance.

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

mono/mini/mini.c

index 6862e83fd295dca59e26016a17a61fb3493d26e0..281b18cb10b2e746e5439b5dca804f3fe375252b 100644 (file)
@@ -5900,13 +5900,13 @@ mono_find_class_init_trampoline_by_addr (gconstpointer addr)
        return res;
 }
 
-static GHashTable *emul_opcode_hash = NULL;
+static MonoJitICallInfo **emul_opcode_map = NULL;
 
-static MonoJitICallInfo *
+static inline MonoJitICallInfo *
 mono_find_jit_opcode_emulation (int opcode)
 {
-       if  (emul_opcode_hash)
-               return g_hash_table_lookup (emul_opcode_hash, (gpointer)opcode);
+       if  (emul_opcode_map)
+               return emul_opcode_map [opcode];
        else
                return NULL;
 }
@@ -5916,15 +5916,15 @@ mono_register_opcode_emulation (int opcode, const char *name, MonoMethodSignatur
 {
        MonoJitICallInfo *info;
 
-       if (!emul_opcode_hash)
-               emul_opcode_hash = g_hash_table_new (NULL, NULL);
+       if (!emul_opcode_map)
+               emul_opcode_map = g_new0 (MonoJitICallInfo*, OP_LAST + 1);
 
        g_assert (!sig->hasthis);
        g_assert (sig->param_count < 3);
 
        info = mono_register_jit_icall (func, name, sig, no_throw);
 
-       g_hash_table_insert (emul_opcode_hash, (gpointer)opcode, info);
+       emul_opcode_map [opcode] = info;
 }
 
 static void