Quellcode durchsuchen

accel/tcg: Hoist tb_cflags to a local in translator_loop

The access internal to tb_cflags() is atomic.
Avoid re-reading it as such for the multiple uses.

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Richard Henderson vor 4 Jahren
Ursprung
Commit
d40c5c7976
1 geänderte Dateien mit 4 neuen und 5 gelöschten Zeilen
  1. 4 5
      accel/tcg/translator.c

+ 4 - 5
accel/tcg/translator.c

@@ -50,6 +50,7 @@ bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest)
 void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
 void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
                      CPUState *cpu, TranslationBlock *tb, int max_insns)
                      CPUState *cpu, TranslationBlock *tb, int max_insns)
 {
 {
+    uint32_t cflags = tb_cflags(tb);
     bool plugin_enabled;
     bool plugin_enabled;
 
 
     /* Initialize DisasContext */
     /* Initialize DisasContext */
@@ -72,8 +73,7 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
     ops->tb_start(db, cpu);
     ops->tb_start(db, cpu);
     tcg_debug_assert(db->is_jmp == DISAS_NEXT);  /* no early exit */
     tcg_debug_assert(db->is_jmp == DISAS_NEXT);  /* no early exit */
 
 
-    plugin_enabled = plugin_gen_tb_start(cpu, tb,
-                                         tb_cflags(db->tb) & CF_MEMI_ONLY);
+    plugin_enabled = plugin_gen_tb_start(cpu, tb, cflags & CF_MEMI_ONLY);
 
 
     while (true) {
     while (true) {
         db->num_insns++;
         db->num_insns++;
@@ -88,14 +88,13 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
            update db->pc_next and db->is_jmp to indicate what should be
            update db->pc_next and db->is_jmp to indicate what should be
            done next -- either exiting this loop or locate the start of
            done next -- either exiting this loop or locate the start of
            the next instruction.  */
            the next instruction.  */
-        if (db->num_insns == db->max_insns
-            && (tb_cflags(db->tb) & CF_LAST_IO)) {
+        if (db->num_insns == db->max_insns && (cflags & CF_LAST_IO)) {
             /* Accept I/O on the last instruction.  */
             /* Accept I/O on the last instruction.  */
             gen_io_start();
             gen_io_start();
             ops->translate_insn(db, cpu);
             ops->translate_insn(db, cpu);
         } else {
         } else {
             /* we should only see CF_MEMI_ONLY for io_recompile */
             /* we should only see CF_MEMI_ONLY for io_recompile */
-            tcg_debug_assert(!(tb_cflags(db->tb) & CF_MEMI_ONLY));
+            tcg_debug_assert(!(cflags & CF_MEMI_ONLY));
             ops->translate_insn(db, cpu);
             ops->translate_insn(db, cpu);
         }
         }