diff mbox series

[1/2] target/hppa: Check page crossings in use_goto_tb() only in system mode

Message ID 20200519162144.10831-2-ahmedkhaledkaraman@gmail.com
State New
Headers show
Series [1/2] target/hppa: Check page crossings in use_goto_tb() only in system mode | expand

Commit Message

Ahmed Karaman May 19, 2020, 4:21 p.m. UTC
Restrict page crossing check to system mode only. By doing this, the
hppa target performance in user mode improves by up to 6.93%. Of course,
the amount of performance improvement will vary depending on the nature
of the hppa executable being emulated by QEMU.

While doing this correction, this patch adds some more verbose
comments in use_goto_tb() as well.

Signed-off-by: Ahmed Karaman <ahmedkhaledkaraman@gmail.com>
---
 target/hppa/translate.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 52d7bea1ea..7c9180cd76 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -817,10 +817,20 @@  static bool gen_illegal(DisasContext *ctx)
 
 static bool use_goto_tb(DisasContext *ctx, target_ureg dest)
 {
-    /* Suppress goto_tb for page crossing, IO, or single-steping.  */
-    return !(((ctx->base.pc_first ^ dest) & TARGET_PAGE_MASK)
-             || (tb_cflags(ctx->base.tb) & CF_LAST_IO)
-             || ctx->base.singlestep_enabled);
+    /* No direct translation block linking with CF_LAST_IO or in singlestep */
+    if ((tb_cflags(ctx->base.tb) & CF_LAST_IO) ||
+        ctx->base.singlestep_enabled) {
+        return false;
+    }
+
+#ifndef CONFIG_USER_ONLY
+    /* Directly link translation blocks only from inside the same guest page */
+    if ((ctx->base.pc_first ^ dest) & TARGET_PAGE_MASK) {
+        return false;
+    }
+#endif
+
+    return true;
 }
 
 /* If the next insn is to be nullified, and it's on the same page,