qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: "Andreas Färber" <andreas.faerber@web.de>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv
Date: Tue, 13 Dec 2011 16:26:56 +0000	[thread overview]
Message-ID: <201112131626.57262.paul@codesourcery.com> (raw)
In-Reply-To: <4EE74858.40107@web.de>

> >>> You've almost no chance of getting
> >>> it right.  In some cases the correct answer will be to use 32-bit
> >>> arithmetic, then sign/zero extend the result. In other cases the
> >>> correct answer will be to perform word size arithmetic.  Blindly
> >>> picking one just makes the bugs harder to find later.
> >> 
> >> This series picks nothing blindly.
> > 
> > Sure it does
> 
> No, start by reading the git summary. These four patches don't touch
> target-* at all.
>
> This is intentionally NOT some Coccinelle script running wild doing
> refactorings. That's what I would call "blindly".

IIUC these four patches do precicely nothing. They simply add a pile of dead 
code. If you don't intent on making these checks pass for all targets, and 
enabling them for at least debug builds then I strongly object.  These checks 
will bitrot rapidly if not routinely enforced.

> > Ther are three ways to resolve a mismatch:
> > - Change everything to TCGv_i32.
> > - Change everything to TCGv.
> > - Add an explicit extension/truncation (compiles to no-op on 32-bit
> > targets).
> > 
> > There's no way of the developer of a 32-bit architecture to know
> 
> Again, that's where we disagree:
> 
> The whole point of TCGv and tl is to have variable-sized operations
> scaling with target_long.

So you're claiming that a 32-bit only target can somehow distinguish between a 
32-bit value, and a value that is architecturally defined to always be 32-bit.  
I don't believe any useful determination can be made in this case.

For targets with different target_ulong variants simply building those 
variants with the existing checks will already highlight any mismatches.

AFAICS the best you can do is say that 32-bit only targets should never use 
TCGv. While that might be a nice idea in theory, the opposite is true for the 
current code base.  This is because the original TCG implementation did not do 
any static typing, i.e. everything was TCGv.  It was only later that I gave 
TCG variables a static size.  I see no practical harm from leaving that as-is.  
Introducing a substantial amount of churn and extra complication to achieve a 
purely theoretical goal is a bad idea.

> I have already given four examples to Peter, that you quoted previously.

The examples I quoted where where TCGv and TCGv_i32 were mixed, but I don't 
see how any of those could possibly cause incorrect behovior.  If the two were 
ever different then this would already fail to compile.

So I'll ask again: Please give a worked example of a programming error that is 
caught by your new restrictions. Feel free to use hypothetical code and/or 
targets.

Paul

  reply	other threads:[~2011-12-13 16:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10  9:02 [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv Andreas Färber
2011-12-10  9:02 ` [Qemu-devel] [PATCH 1/4] tcg: Introduce {MAKE,GET}_TCGV_TL macros Andreas Färber
2011-12-10  9:02 ` [Qemu-devel] [PATCH 2/4] tcg: Convert *_tl*() macros to inline functions Andreas Färber
2011-12-10 21:06   ` [Qemu-devel] [PATCH v2] " Andreas Färber
2011-12-10  9:02 ` [Qemu-devel] [PATCH 3/4] tcg: Update TCGV_{UNUSED,EQUAL}() macros Andreas Färber
2011-12-10  9:02 ` [Qemu-devel] [PATCH 4/4] tcg: Allow to detect TCGv misuses Andreas Färber
2011-12-10 10:07 ` [Qemu-devel] [PATCH 0/4] tcg: Add debug facilities for TCGv Peter Maydell
2011-12-10 11:14   ` Andreas Färber
2011-12-11 23:28     ` Paul Brook
2011-12-12 10:39       ` Andreas Färber
2011-12-12 15:58         ` Paul Brook
2011-12-13 12:43           ` Andreas Färber
2011-12-13 16:26             ` Paul Brook [this message]
2011-12-14 11:41               ` Andreas Färber
2011-12-13 13:11           ` Andreas Färber
2011-12-13 16:23             ` Paul Brook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201112131626.57262.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=andreas.faerber@web.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).