Commit 2c90fe2b authored by Kirill Batuzov's avatar Kirill Batuzov Committed by Blue Swirl
Browse files

Speedup 'tb_find_slow' by using the same heuristic as during memory page lookup

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: default avatarKirill Batuzov <>
Signed-off-by: default avatarPavel Yushchenko <>
Signed-off-by: default avatarBlue Swirl <>
parent 53016fa6
......@@ -167,6 +167,12 @@ static TranslationBlock *tb_find_slow(target_ulong pc,
tb = tb_gen_code(env, pc, cs_base, flags, 0);
/* 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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment