[Qemu-devel] [PATCH 1/3] translator: add retcode to translator_loop_temp_check

Emilio G. Cota posted 3 patches 7 years, 8 months ago
[Qemu-devel] [PATCH 1/3] translator: add retcode to translator_loop_temp_check
Posted by Emilio G. Cota 7 years, 8 months ago
This will allow us to print further info from target code.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 accel/tcg/translator.c    | 4 +++-
 include/exec/translator.h | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index 23c6602..f409a95 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -23,12 +23,14 @@
    (1) the target is sufficiently clean to support reporting,
    (2) as and when all temporaries are known to be consumed.
    For most targets, (2) is at the end of translate_insn.  */
-void translator_loop_temp_check(DisasContextBase *db)
+int translator_loop_temp_check(DisasContextBase *db)
 {
     if (tcg_check_temp_count()) {
         qemu_log("warning: TCG temporary leaks before "
                  TARGET_FMT_lx "\n", db->pc_next);
+        return 1;
     }
+    return 0;
 }
 
 void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
diff --git a/include/exec/translator.h b/include/exec/translator.h
index e2dc2a0..8833340 100644
--- a/include/exec/translator.h
+++ b/include/exec/translator.h
@@ -139,6 +139,6 @@ typedef struct TranslatorOps {
 void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
                      CPUState *cpu, TranslationBlock *tb);
 
-void translator_loop_temp_check(DisasContextBase *db);
+int translator_loop_temp_check(DisasContextBase *db);
 
 #endif  /* EXEC__TRANSLATOR_H */
-- 
2.7.4


Re: [Qemu-devel] [PATCH 1/3] translator: add retcode to translator_loop_temp_check
Posted by Richard Henderson 7 years, 8 months ago
On 02/14/2018 07:14 PM, Emilio G. Cota wrote:
> -void translator_loop_temp_check(DisasContextBase *db);
> +int translator_loop_temp_check(DisasContextBase *db);
>  

bool.

Although I don't see how this is helpful.  If you want to customize the output,
surely you just use tcg_check_temp_count directly?


r~

Re: [Qemu-devel] [PATCH 1/3] translator: add retcode to translator_loop_temp_check
Posted by Emilio G. Cota 7 years, 8 months ago
On Thu, Feb 15, 2018 at 07:09:56 -0800, Richard Henderson wrote:
> On 02/14/2018 07:14 PM, Emilio G. Cota wrote:
> > -void translator_loop_temp_check(DisasContextBase *db);
> > +int translator_loop_temp_check(DisasContextBase *db);
> 
> bool.
> 
> Although I don't see how this is helpful.  If you want to customize the output,
> surely you just use tcg_check_temp_count directly?

The only advantage is that we get to keep the same warning on
all targets [that support the temps' check]. Admittedly
not a huge benefit; I can drop this if you want.

Thanks,

		E.