public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joe Buck <Joe.Buck@synopsys.COM>
To: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: Ian Lance Taylor <ian@wasabisystems.com>,
	mark@codesourcery.com, gcc@gcc.gnu.org
Subject: Re: Compiler uses a lot of memory for large initialized arrays
Date: Thu, 02 Dec 2004 18:18:00 -0000	[thread overview]
Message-ID: <20041202101803.A18628@synopsys.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0412021631560.26457@digraph.polyomino.org.uk>; from joseph@codesourcery.com on Thu, Dec 02, 2004 at 04:34:35PM +0000

On Thu, Dec 02, 2004 at 04:34:35PM +0000, Joseph S. Myers wrote:
> On Thu, 2 Dec 2004, Ian Lance Taylor wrote:
> 
> > This test case works fine with 2.95.3.  Looking into the patches I
> > came across this note from you from four years ago:
> >     http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00937.html
> 
> And hopefully you came across the November part of the thread as well: C99 
> designated initializers allow
> 
> int i[10000000] = { 0, 1, 2, 3, 4, 5, /* ... */
> 9999998, 9999999, [0] = -1 };
> 
> which stops optimizing in the simplest way by writing out initializers to 
> the assembler output before the whole initializer has been parsed.

Here's an ugly hack: write large initializers to a temporary file
(say, when the number of elements in the initializer reaches some
threshold, like 500).

If we successfully reach the end of the initializer without anything evil
like the above case, then append the temp file to the assembly output.
Otherwise, go back and do it in memory.

  parent reply	other threads:[~2004-12-02 18:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-02 16:08 Ian Lance Taylor
2004-12-02 16:34 ` Joseph S. Myers
2004-12-02 17:03   ` Ian Lance Taylor
2004-12-02 17:05   ` Steven Bosscher
2004-12-02 17:12     ` Richard Guenther
2004-12-02 17:17       ` Nathan Sidwell
2004-12-02 17:29         ` Peter Barada
2004-12-02 17:39           ` Mark Mitchell
2004-12-02 17:42           ` Ian Lance Taylor
2004-12-02 17:49           ` Dave Korn
2004-12-02 17:36       ` Andreas Schwab
2004-12-02 18:18   ` Joe Buck [this message]
2004-12-02 18:23     ` Mark Mitchell
2004-12-02 17:31 ` Mark Mitchell
2004-12-02 17:33 ` Giovanni Bajo

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=20041202101803.A18628@synopsys.com \
    --to=joe.buck@synopsys.com \
    --cc=gcc@gcc.gnu.org \
    --cc=ian@wasabisystems.com \
    --cc=joseph@codesourcery.com \
    --cc=mark@codesourcery.com \
    /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).