public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wilson at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/25468] [3.4 Regression] -g makes g++ loop forever
Date: Wed, 08 Feb 2006 04:02:00 -0000	[thread overview]
Message-ID: <20060208040215.3083.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25468-1902@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from wilson at gcc dot gnu dot org  2006-02-08 04:02 -------
The problem here is ASM_OUTPUT_ASCII.

The testcase is a big file with a lot of functions that have long function
names.  It is 4MB of C++ code, producing a 28MB .s file in about 15 seconds. 
If I add -Q and pipe the output to a file, I get 123MB, which means we have a
lot of strings just for the function names.  Adding -g, it takes about 20
minutes to compile the file, producing a .s file of about 108MB.  Of the extra
80MB much of it is going through ASM_OUTPUT_ASCII.

If you look at ASM_OUTPUT_ASCII, you see that the code uses putc to print one
character at a time while checking for characters that need to be quoted.  It
also throws in a lot of extra fprintf calls just to make this even slower.  So
we are trying to feed maybe 70MB through putc, and obviously, that is going to
take a lot of time.

If I hack in a definition of ASM_OUTPUT_ASCII that just uses 3 fputs calls,
then  it compiles in about 16 seconds.  This isn't quite right, as we are
missing quoting for special characters, but this clearly shows that the problem
is here in ASM_OUTPUT_ASCII.

There are some complicating factors here.  Some assemblers can't handle long
lines in the .ascii directive, so we deliberately break up the output into
lines less than 80 characters.  This can perhaps be dropped if we know we are
using GNU as.  We could maybe document the allowed line lengths for other
assemblers instead of assuming it is 80 characters.

ASM_OUTPUT_ASCII is defined in a lot of different files in subtly different
ways, and they all have this problem.

If we can assume that function names never contain special characters that need
quoting, then we can perhaps solve the problem by not using ASM_OUTPUT_ASCII
for this.  We could have a simpler and faster routine that doesn't worry about
the need to emit quoting characters.  This should be true for C.  I'm not sure
about C++ and the other languages.  This is probably a risky assumption to
make.

ASM_OUTPUT_ASCII could be faster if it scanned forward for the next special
character that needs quoting, then then emits everything up to the next special
character via puts (or whatever), modulo the allowed line length.


-- 

wilson at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilson at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-08 04:02:15
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25468


  parent reply	other threads:[~2006-02-08  4:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-17 22:14 [Bug c++/25468] New: " sylvain dot pion at sophia dot inria dot fr
2005-12-17 22:26 ` [Bug c++/25468] " sylvain dot pion at sophia dot inria dot fr
2005-12-17 23:26 ` [Bug debug/25468] [3.4 Regression] " sylvain dot pion at sophia dot inria dot fr
2005-12-17 23:27 ` pinskia at gcc dot gnu dot org
2006-02-08  4:02 ` wilson at gcc dot gnu dot org [this message]
2006-06-04 19:30 ` [Bug debug/25468] [4.0/4.1/4.2 " jsm28 at gcc dot gnu dot org
2006-06-04 19:52 ` mmitchel at gcc dot gnu dot org
2006-07-22 16:36 ` steven at gcc dot gnu dot org
2006-07-23 11:51 ` steven at gcc dot gnu dot org
2006-07-23 13:11 ` steven at gcc dot gnu dot org
2006-07-23 14:55 ` steven at gcc dot gnu dot org
2006-07-23 17:56 ` steven at gcc dot gnu dot org
2006-07-23 17:57 ` [Bug debug/25468] [4.0/4.1 " steven at gcc dot gnu dot org
2006-07-31 22:09 ` steven at gcc dot gnu dot org
2006-07-31 22:13 ` [Bug debug/25468] [4.0 " pinskia at gcc dot gnu dot org
2006-07-31 22:14 ` steven at gcc dot gnu dot org
2006-07-31 22:14 ` steven at gcc dot gnu dot org
2007-02-03 16:10 ` gdr at gcc dot gnu dot org

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=20060208040215.3083.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.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.
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).