]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup
authorKirill Batuzov <batuzovk@ispras.ru>
Thu, 2 Dec 2010 13:12:46 +0000 (16:12 +0300)
committerBlue Swirl <blauwirbel@gmail.com>
Sun, 5 Dec 2010 08:09:07 +0000 (08:09 +0000)
Move the last found TB to the head of the list so it will be found more quickly next time it will be looked for.

Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Pavel Yushchenko <pau@ispras.ru>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cpu-exec.c

index dbdfdccd8cc3d788c2065e16fc1dc9679aaf539c..39e5eeaa8fc51ad839cd58006084b9f28061a58f 100644 (file)
@@ -167,6 +167,12 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
     tb = tb_gen_code(env, pc, cs_base, flags, 0);
 
  found:
+    /* Move the last found TB to the head of the list */
+    if (likely(*ptb1)) {
+        *ptb1 = tb->phys_hash_next;
+        tb->phys_hash_next = tb_phys_hash[h];
+        tb_phys_hash[h] = tb;
+    }
     /* we add the TB in the virtual pc hash table */
     env->tb_jmp_cache[tb_jmp_cache_hash_func(pc)] = tb;
     return tb;