This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mainline "exploding"

On Wed, 2003-10-15 at 18:31, Zack Weinberg wrote:
> Geoff Keating <> writes:
> > Please remember, unit-at-a-time means very high memory use for some
> > input files.  We cannot have it as the only choice unless there's some
> > limit on peak memory use, and that means throwing away some function
> > bodies early.
> Please back this assertion up with actual test cases and numbers.  All
> evidence to date is that unit-at-a-time takes less memory on real code.

One can certainly concoct examples where Geoff's assertion will be true:
a zillion non-inline functions in a single file, for example.

However, as I mentioned earlier, unit-at-a-time is the way almost every
other compiler works -- and they don't have as much of a memory problem
as GCC.  

So, the problem isn't unit-at-a-time -- it's our bad data structures,
and our inlining heuristics.  That said, if our data structures or
heuristics are truly horrible, we might have to hold off on
unit-at-a-time until they are fixed.

Also, the way that unit-at-a-time *should* work (although I don't know
if this is how it *does* work) is:

(1) Build trees for every function, doing no optimizations other than
constant-folding, etc. as done in the front end.

(2) Pick a function that needs to be output.  Inline into it, optimize
it, output it, and throw the body away -- unless it will itself be
inlined into something else.  (Ideally, the function picked would be one
that is not going to be inlined into something else; that will throw
away stuff as quickly as possible.)

(3) Repeat (2) until done.

Mark Mitchell <>
CodeSourcery, LLC

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]