Skip to contentSkip to conversation

target/arm: Free TCG temps in trans_VMOV_64_sp()

PATCH In review Peter Maydell 5 participants 6 messages Aug 27, 2019 – Sep 3, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/arm: Free TCG temps in trans_VMOV_64_sp()

The function neon_store_reg32() doesn't free the TCG temp that it is passed, so the caller must do that. We got this right in most places but forgot to free the TCG temps in trans_VMOV_64_sp().

---
 target/arm/translate-vfp.inc.c | 2 ++
 1 file changed, 2 insertions(+)
target/arm/translate-vfp.inc.c +2 -0
index 3e8ea80493b..9ae980bef63 100644
@@ -880,8 +880,10 @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a)
         /* gpreg to fpreg */
         tmp = load_reg(s, a->rt);
         neon_store_reg32(tmp, a->vm);
+        tcg_temp_free_i32(tmp);
         tmp = load_reg(s, a->rt2);
         neon_store_reg32(tmp, a->vm + 1);
+        tcg_temp_free_i32(tmp);
     }
 
     return true;
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Maydell
Quoted 15 lines · Peter Maydell

The function neon_store_reg32() doesn't free the TCG temp that it is passed, so the caller must do that. We got this right in most places but forgot to free the TCG temps in trans_VMOV_64_sp().

---
 target/arm/translate-vfp.inc.c | 2 ++
 1 file changed, 2 insertions(+)
target/arm/translate-vfp.inc.c +0 -0
index 3e8ea80493b..9ae980bef63 100644

target/arm/translate-vfp.inc.c static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a) · line 889

Quoted 10 lines
target/arm/translate-vfp.inc.c +2 -0
@@ -880,8 +880,10 @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a)
         /* gpreg to fpreg */
         tmp = load_reg(s, a->rt);
         neon_store_reg32(tmp, a->vm);
+        tcg_temp_free_i32(tmp);
         tmp = load_reg(s, a->rt2);
         neon_store_reg32(tmp, a->vm + 1);
+        tcg_temp_free_i32(tmp);
     }
 
     return true;
#3 lore raw
In reply to Peter Maydell

27.08.2019. 14.20, "Peter Maydell" <[email protected]> је написао/ла:

Quoted 8 lines

The function neon_store_reg32() doesn't free the TCG temp that it is passed, so the caller must do that. We got this right in most places but forgot to free the TCG temps in trans_VMOV_64_sp().

---

Hello, Peter,

I am just curious if you found this by manual code inspection, or perhaps using a tool?

Yours,
Aleksandar

Review

Quoted 4 lines
 target/arm/translate-vfp.inc.c | 2 ++
 1 file changed, 2 insertions(+)
(quoted diff) +0 -0

b/target/arm/translate-vfp.inc.c

target/arm/translate-vfp.inc.c static bool trans_VMOV_64_sp(DisasContext *s,

Quoted 4 lines

index 3e8ea80493b..9ae980bef63 100644

target/arm/translate-vfp.inc.c +0 -0
@@ -880,8 +880,10 @@ static bool trans_VMOV_64_sp(DisasContext *s,

arg_VMOV_64_sp *a)

Quoted 14 lines
target/arm/translate-vfp.inc.c +2 -1
         /* gpreg to fpreg */
         tmp = load_reg(s, a->rt);
         neon_store_reg32(tmp, a->vm);
+        tcg_temp_free_i32(tmp);
         tmp = load_reg(s, a->rt2);
         neon_store_reg32(tmp, a->vm + 1);
+        tcg_temp_free_i32(tmp);
     }
 
     return true;
--

2.20.1

#4 lore raw
Quoted 6 lines · Aleksandar Markovic

27.08.2019. 14.20, "Peter Maydell" <[email protected]> је написао/ла:

Quoted 5 lines

The function neon_store_reg32() doesn't free the TCG temp that it is passed, so the caller must do that. We got this right in most places but forgot to free the TCG temps in trans_VMOV_64_sp().

Quoted 8 lines
Quoted 3 lines

---

Hello, Peter,

I am just curious if you found this by manual code inspection, or perhaps using a tool?

I'm guessing that if you run code that exercises this while built with --enable-tcg-debug then TCG's sanity checking complains about unfreed temps.

Quoted 7 lines

Yours,
Aleksandar

Quoted 3 lines
 target/arm/translate-vfp.inc.c | 2 ++
 1 file changed, 2 insertions(+)
Quoted 21 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/target/arm/translate-vfp.inc.c

target/arm/translate-vfp.inc.c static bool trans_VMOV_64_sp(DisasContext *s,

Quoted 4 lines

index 3e8ea80493b..9ae980bef63 100644

target/arm/translate-vfp.inc.c +0 -0
@@ -880,8 +880,10 @@ static bool trans_VMOV_64_sp(DisasContext *s,

arg_VMOV_64_sp *a)

Quoted 14 lines
target/arm/translate-vfp.inc.c +2 -1
         /* gpreg to fpreg */
         tmp = load_reg(s, a->rt);
         neon_store_reg32(tmp, a->vm);
+        tcg_temp_free_i32(tmp);
         tmp = load_reg(s, a->rt2);
         neon_store_reg32(tmp, a->vm + 1);
+        tcg_temp_free_i32(tmp);
     }
 
     return true;
--

2.20.1

--
Alex Bennée

#5 lore raw
Quoted 9 lines · Alex Bennée
Quoted 2 lines · Aleksandar Markovic

I am just curious if you found this by manual code inspection, or perhaps using a tool?

I'm guessing that if you run code that exercises this while built with --enable-tcg-debug then TCG's sanity checking complains about unfreed temps.

Yes, exactly -- this was producing warnings for a random bit of guest code I happened to be running. (I run most of my testing with an --enable-debug build, which includes the TCG debug).

thanks
-- PMM