qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-for-5.0?] decodetree: Use Python3 floor division operator
@ 2020-03-30 12:13 Philippe Mathieu-Daudé
  2020-03-30 12:54 ` Peter Maydell
  2020-03-30 17:14 ` Richard Henderson
  0 siblings, 2 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-03-30 12:13 UTC (permalink / raw)
  To: qemu-devel
  Cc: Eduardo Habkost, Yoshinori Sato, Philippe Mathieu-Daudé,
	Cleber Rosa, Paolo Bonzini, Richard Henderson

This script started using Python2, where the 'classic' division
operator returns the floor result. In commit 3d004a371 we started
to use Python3, where the division operator returns the float
result ('true division').
To keep the same behavior, use the 'floor division' operator "//"
which returns the floor result.

Fixes: 3d004a371
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
We didn't notice it because only the RX port (which uses the
--varinsnwidth option, and got merged very recently) triggers
these problems.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 scripts/decodetree.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/decodetree.py b/scripts/decodetree.py
index 2a8f2b6e06..46ab917807 100755
--- a/scripts/decodetree.py
+++ b/scripts/decodetree.py
@@ -1025,7 +1025,7 @@ def output_code(self, i, extracted, outerbits, outermask):
         if extracted < self.width:
             output(ind, 'insn = ', decode_function,
                    '_load_bytes(ctx, insn, {0}, {1});\n'
-                   .format(extracted / 8, self.width / 8));
+                   .format(extracted // 8, self.width // 8));
             extracted = self.width
 
         # Attempt to aid the compiler in producing compact switch statements.
@@ -1079,7 +1079,7 @@ def output_code(self, i, extracted, outerbits, outermask):
         if extracted < self.width:
             output(ind, 'insn = ', decode_function,
                    '_load_bytes(ctx, insn, {0}, {1});\n'
-                   .format(extracted / 8, self.width / 8));
+                   .format(extracted // 8, self.width // 8));
             extracted = self.width
         output(ind, 'return insn;\n')
 # end SizeLeaf
-- 
2.21.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.0?] decodetree: Use Python3 floor division operator
  2020-03-30 12:13 [PATCH-for-5.0?] decodetree: Use Python3 floor division operator Philippe Mathieu-Daudé
@ 2020-03-30 12:54 ` Peter Maydell
  2020-03-30 17:14 ` Richard Henderson
  1 sibling, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2020-03-30 12:54 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Eduardo Habkost, Yoshinori Sato, QEMU Developers, Cleber Rosa,
	Paolo Bonzini, Richard Henderson

On Mon, 30 Mar 2020 at 13:14, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> This script started using Python2, where the 'classic' division
> operator returns the floor result. In commit 3d004a371 we started
> to use Python3, where the division operator returns the float
> result ('true division').
> To keep the same behavior, use the 'floor division' operator "//"
> which returns the floor result.
>
> Fixes: 3d004a371
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> We didn't notice it because only the RX port (which uses the
> --varinsnwidth option, and got merged very recently) triggers
> these problems.
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Ouch. That's a painfully hard to detect incompatibility
between 2 and 3 :-(

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.0?] decodetree: Use Python3 floor division operator
  2020-03-30 12:13 [PATCH-for-5.0?] decodetree: Use Python3 floor division operator Philippe Mathieu-Daudé
  2020-03-30 12:54 ` Peter Maydell
@ 2020-03-30 17:14 ` Richard Henderson
  2020-03-30 18:46   ` Richard Henderson
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2020-03-30 17:14 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Yoshinori Sato, Cleber Rosa

On 3/30/20 5:13 AM, Philippe Mathieu-Daudé wrote:
> This script started using Python2, where the 'classic' division
> operator returns the floor result. In commit 3d004a371 we started
> to use Python3, where the division operator returns the float
> result ('true division').
> To keep the same behavior, use the 'floor division' operator "//"
> which returns the floor result.
> 
> Fixes: 3d004a371
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> We didn't notice it because only the RX port (which uses the
> --varinsnwidth option, and got merged very recently) triggers
> these problems.
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  scripts/decodetree.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.0?] decodetree: Use Python3 floor division operator
  2020-03-30 17:14 ` Richard Henderson
@ 2020-03-30 18:46   ` Richard Henderson
  2020-03-30 23:28     ` Aleksandar Markovic
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2020-03-30 18:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Yoshinori Sato, Cleber Rosa

On 3/30/20 10:14 AM, Richard Henderson wrote:
> On 3/30/20 5:13 AM, Philippe Mathieu-Daudé wrote:
>> This script started using Python2, where the 'classic' division
>> operator returns the floor result. In commit 3d004a371 we started
>> to use Python3, where the division operator returns the float
>> result ('true division').
>> To keep the same behavior, use the 'floor division' operator "//"
>> which returns the floor result.
>>
>> Fixes: 3d004a371
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> We didn't notice it because only the RX port (which uses the
>> --varinsnwidth option, and got merged very recently) triggers
>> these problems.
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>>  scripts/decodetree.py | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Queued to tcg-next for 5.0.


r~



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.0?] decodetree: Use Python3 floor division operator
  2020-03-30 18:46   ` Richard Henderson
@ 2020-03-30 23:28     ` Aleksandar Markovic
  2020-03-30 23:53       ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Aleksandar Markovic @ 2020-03-30 23:28 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Eduardo Habkost, Yoshinori Sato, Philippe Mathieu-Daudé,
	QEMU Developers, Cleber Rosa, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 1250 bytes --]

20:47 Pon, 30.03.2020. Richard Henderson <rth@twiddle.net> је написао/ла:
>
> On 3/30/20 10:14 AM, Richard Henderson wrote:
> > On 3/30/20 5:13 AM, Philippe Mathieu-Daudé wrote:
> >> This script started using Python2, where the 'classic' division
> >> operator returns the floor result. In commit 3d004a371 we started
> >> to use Python3, where the division operator returns the float
> >> result ('true division').
> >> To keep the same behavior, use the 'floor division' operator "//"
> >> which returns the floor result.
> >>
> >> Fixes: 3d004a371
> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> >> ---
> >> We didn't notice it because only the RX port (which uses the
> >> --varinsnwidth option, and got merged very recently) triggers
> >> these problems.
> >> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> >> ---
> >>  scripts/decodetree.py | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >
> > Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> Queued to tcg-next for 5.0.
>

Richard, great, could you please pick up the LMI patch from the other day
together with this patch in your tcg-5.0 queue?

Yours, Aleksandar

>
> r~
>
>

[-- Attachment #2: Type: text/html, Size: 1885 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH-for-5.0?] decodetree: Use Python3 floor division operator
  2020-03-30 23:28     ` Aleksandar Markovic
@ 2020-03-30 23:53       ` Richard Henderson
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2020-03-30 23:53 UTC (permalink / raw)
  To: Aleksandar Markovic, Richard Henderson
  Cc: Eduardo Habkost, Yoshinori Sato, QEMU Developers,
	Philippe Mathieu-Daudé, Cleber Rosa, Paolo Bonzini

On 3/30/20 4:28 PM, Aleksandar Markovic wrote:
> Richard, great, could you please pick up the LMI patch from the other day
> together with this patch in your tcg-5.0 queue?

Yes, I've got it.

r~


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-03-30 23:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-30 12:13 [PATCH-for-5.0?] decodetree: Use Python3 floor division operator Philippe Mathieu-Daudé
2020-03-30 12:54 ` Peter Maydell
2020-03-30 17:14 ` Richard Henderson
2020-03-30 18:46   ` Richard Henderson
2020-03-30 23:28     ` Aleksandar Markovic
2020-03-30 23:53       ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).