This is the mail archive of the gcc@gcc.gnu.org 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]

Re: compiling multiple source files at once


Andreas Jaeger wrote:

> Per Bothner <per@bothner.com> writes:
>
> > There are other advantages becsides compilation speed.  For Java, we
> > can add an extra flag specifying that an emtire "package" is being
> > compiled, which allows valuable optimizations.  In any case, we can
> > save space due to reduced duplication of things like string literals.
>
> This also allows to do optimizions not only on a single file level but
> on an number of files.  One compiler on a Sun I used had this feature
> which lead to further speedup.

In Java, it is also a step towards supporting the idea of "package
closure" or even global application closure. This means that many more
optimizations can be done since the compiler has complete knowledge of
everything that references a particular method or field, assuming that new
classes won't be dynamically loaded at runtime (which is usually a
reasonable assumption in the package case). For example, the compiler can
easily tell that no other class overrides a particular package-private
(default access) method, so it can be inlined unconditionally.

Actually, I'd like to be able to explictly tell the compiler I want to
build a particular package, rather than specifying a long list of .java
files. This would make it simpler for the user to invoke the compiler and
also make it easier for the compiler to figure out when it should do
package optimizations.

regards

  [ bryce ]



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