This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: compiling multiple source files at once
- To: Per Bothner <per at bothner dot com>
- Subject: Re: compiling multiple source files at once
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Tue, 6 Feb 2001 07:59:50 +0000
- Cc: java at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- References: <m2n1c0k12a.fsf@kelso.bothner.com>
Per Bothner wrote:-
> I mention this on the general gcc list because the same idea could also
> be useful for compiling (say) large C++ projects. Instead of compiling
> A.cc, C.cc, amd C.cc separately, each of which includes large header files
> A.h, B.h, C.h, and X.y, you would compile them also at once:
> g++ -c -o abc.o A.cc B.cc C.cc
> We could could require "well-behaved" header files for this is, so
> compiling A.cc, B.cc, and C.cc would be treated as essentially the same
> as abc.cc:
> #include "A.cc"
> #include "B.cc"
> #include "C.cc"
>
> except that some care might be needed to deal with static symbols (and
> namespaces).
I imagine most of this benefit, possibly with less restrictions, could
come from Geoff's precompiled header work (though he's never explained
the details of how they're going to work).
> But doing this should substantially speed up compilations.
> It also creates much small executables, since there would only be a
> *single* copy in abc.o) of the declarations in the header files.
It would provide reasonable performance gains to have the driver
invoked just once like this, and (say) cc1 invoked just once, too,
and to have the single instance compile all the files.
This would be easy to implement for the cpplib part of cc1, but I
imagine being able to reset the state of the compiler proper would be
much harder to guarantee, given all the static variables and other
stuff it uses, and maybe not worth it.
Neil.