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]

Apple's implementation of precompiled headers

As many people know, Apple has adopted GCC as the standard system
compiler for Mac OS X.  Not only is it used to build all of OS X,
but we also make it available to Apple's developers.  While many
developers use GCC as a normal command-line batch-type compiler,
we also have an IDE named Project Builder (a distant descendant of
the NeXT app of the same name), and Project Builder uses both GCC
and GDB behind the scenes.

As a result, we have a number of specific requirements for GCC.
The most important currently is that the compiler be capable of
fast turnaround in compiling programs that use large numbers of
headers.  As I've mentioned on this list in the past, Mac developers
compare GCC to Metrowerks' compilers, which typically build Mac
applications in considerably less time than GCC.  Experimental
investigation of compile times shows that most of the difference
can be addressed simply by using precompiled headers.

Our approach to precompiled headers has been to write GCC's trees
and related data into a file, using a format that can be mapped in
and randomly accessed. Changes to GCC are not large, mostly to
replace the low-level memory allocation machinery, and to add hooks
to both "freeze" and "thaw" GCC's internal state.

Right now, we have a prototype that mostly works, and as always
we'd eventually like to offer this for FSF GCC, so this message is
just to bring everybody up to speed with what we're doing, and to
solicit comments on the general strategy.

I know that there are a couple of similar projects, but either we
haven't been able to get access to the code, or the work isn't as
far along as ours.

Looking farther out, we're also interested using this machinery
to enable incremental compilation, indexing info for code browsers,
interprocedural interfile optimization (inlining for instance),
and perhaps even shortcuts for supplying GDB with part of a
program's debug info without going through assembler and linker.

At this moment, the code is partly in Apple's public repository
at, and partly internal still, but we expect
to make it all public very soon.  I'll send out another note when
that happens.


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