unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: rms@gnu.org
Cc: lekktu@gmail.com, emacs-devel@gnu.org
Subject: Re: suppress_checking
Date: Wed, 31 Oct 2007 23:25:08 -0400	[thread overview]
Message-ID: <B646E0A7-554B-439E-9557-C1A5A7ACB592@raeburn.org> (raw)
In-Reply-To: <E1Imjak-0001JF-Fl@fencepost.gnu.org>

On Oct 30, 2007, at 1:24, Richard Stallman wrote:
>     Since CHECK itself just evaluates the test and does nothing  
> with it
>     if ENABLE_CHECKING is not defined, assuming you have a decent
>     optimizing compiler,
>
> We're interested in GCC, not particularly in "decent optimizing
> compilers".  Does GCC in fact optimize these cases?

Certainly GCC would be the main one I'd care about performance-wise,  
and as far as I'm concerned sets the standard for "decent optimizing  
compilers", but I've heard people do sometimes use other compilers. :-)

I haven't actually checked lately if GCC optimizes these cases, but  
given that the test is generally extracting some bits from the object  
value and comparing against a constant, or maybe doing that and then  
fetching a few bits from a computed address to compare against  
another constant, it'd be a real bug in GCC if it failed to optimize  
doing this twice in a row with the same input value and without  
intervening memory writes.  But it is possible, at least in theory,  
that some regression might cause some version of GCC to fail to  
combine the identical calculations, and that it might even escape  
notice until after a release went out.

If there are intervening memory writes or nontrivial function calls,  
and the test in question requires examining the pointed-to values  
(e.g., for misc or vector subtypes), and GCC's alias analysis (which  
is constantly being improved) can't prove they're disjoint locations,  
there would be extra reads from memory, and the associated  
comparisons, unused branches to calls to the "die" function, etc.

...  Okay, I just ran a quick test on my Mac (powerpc, Apple-flavored  
gcc 4.0.1).  The disassembly of a test function that included "if  
(STRINGP (s)) return SDATA (s);", where "s" was an argument to the  
function, showed the test was performed once, and the "die" call  
wasn't present at all.

Ken

  reply	other threads:[~2007-11-01  3:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 15:59 suppress_checking Juanma Barranquero
2007-10-23 10:38 ` suppress_checking Richard Stallman
2007-10-23 10:59   ` suppress_checking Juanma Barranquero
2007-10-24  2:49     ` suppress_checking Richard Stallman
2007-10-24  8:56       ` suppress_checking Juanma Barranquero
2007-10-29 17:51         ` suppress_checking Ken Raeburn
2007-10-29 18:16           ` suppress_checking Ken Raeburn
2007-10-29 22:49             ` suppress_checking Juanma Barranquero
2007-10-29 19:06           ` suppress_checking Stefan Monnier
2007-10-29 20:47             ` suppress_checking Ken Raeburn
2007-10-30  5:24           ` suppress_checking Richard Stallman
2007-11-01  3:25             ` Ken Raeburn [this message]
2007-11-01 19:04               ` suppress_checking Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=B646E0A7-554B-439E-9557-C1A5A7ACB592@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=rms@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).