[PATCH 13/27] accel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers

Richard Henderson posted 27 patches 1 year, 7 months ago
There is a newer version of this series
[PATCH 13/27] accel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers
Posted by Richard Henderson 1 year, 7 months ago
Here we are creating a temp whose value needs to be replaced,
but always storing NULL into CPUState.plugin_mem_cbs.
Use tcg_constant_ptr(0) explicitly.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/plugin-gen.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
index ea875c0990..ae2dbd7ad0 100644
--- a/accel/tcg/plugin-gen.c
+++ b/accel/tcg/plugin-gen.c
@@ -628,16 +628,13 @@ static void inject_mem_disable_helper(struct qemu_plugin_insn *plugin_insn,
 /* called before finishing a TB with exit_tb, goto_tb or goto_ptr */
 void plugin_gen_disable_mem_helpers(void)
 {
-    TCGv_ptr ptr;
-
     if (likely(tcg_ctx->plugin_insn == NULL ||
                !tcg_ctx->plugin_insn->mem_helper)) {
         return;
     }
-    ptr = tcg_const_ptr(NULL);
-    tcg_gen_st_ptr(ptr, cpu_env, offsetof(CPUState, plugin_mem_cbs) -
-                                 offsetof(ArchCPU, env));
-    tcg_temp_free_ptr(ptr);
+
+    tcg_gen_st_ptr(tcg_constant_ptr(NULL), cpu_env,
+                   offsetof(CPUState, plugin_mem_cbs) - offsetof(ArchCPU, env));
     tcg_ctx->plugin_insn->mem_helper = false;
 }
 
-- 
2.34.1
Re: [PATCH 13/27] accel/tcg/plugin: Tidy plugin_gen_disable_mem_helpers
Posted by Philippe Mathieu-Daudé 1 year, 7 months ago
On 30/1/23 21:59, Richard Henderson wrote:
> Here we are creating a temp whose value needs to be replaced,
> but always storing NULL into CPUState.plugin_mem_cbs.
> Use tcg_constant_ptr(0) explicitly.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   accel/tcg/plugin-gen.c | 9 +++------
>   1 file changed, 3 insertions(+), 6 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>