Cross-class inlining

Jeff Sturm
Wed Oct 22 12:06:00 GMT 2003

On Wed, 22 Oct 2003, Robin Garner wrote:
> Under what circumstances does it do this inlining ?  I tried this:
> gcc -O3 -o a.o
> gcc -O3 -o b.o
> gcc -O3 -o c.o
> gcc -O3 -o d.o

The current inliner requires the statement tree to be available for all
methods that are inlining candidates.  So, if gcj hasn't seen the source
code for a method X, it can't inline X.

Inlining is considered only after all source code has been parsed.  It
works independent of declaration order, or order of source files on the
command line.

> Still, the "all in 1" approach gets a 49% speedup over just -O3 on
> individual modules, and 17% better than I could do by hand.

Excellent.  This "all in 1" approach may get faster still in the future
due to whole-program optimizations.

I've been converting my own projects to build this way, if for no reason
other than faster build times.


More information about the Java mailing list