chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] improved inlining


From: felix winkelmann
Subject: [Chicken-users] improved inlining
Date: Wed, 29 Oct 2008 16:08:31 +0100

Hi!


I have added some inlining improvements to the trunk that
might be of interest: together with a bit of compiler cleanup,
inlining has been made more aggressive (a higher default setting
for "inline-limit") and a new compilation mode ("local") has been
added. "local" is what gambit calls "block": it assumes the toplevel
variables in the current compilation unit are not changed outside
of the current one. Note that this is weaker than our "block" mode, which
effectively hides all toplevel variables, allowing to drop definitions
entirely if unused. In this mode, toplevel definitions
can be inlined, if they are assigned only once.

To enable "local" mode, use the "-local" option. Note that
you still have to enable inlining explicitly with "-inline". The
optimization levels have been changed so that -O3 enables
-local -inline (but is still safe) and -O4 adds "-unsafe".

The benchmark suite has been improved (there is a toplevel
"bench" target now) and some tests from the shootout have been
added. The performance gains from local mode vary between
pathetic and dramatic - it is particularly beneficial when you have
many small exported accessor functions, for example.

The new option "-inline-global" allows cross-module inlining by
making functions defined in other compilation units available
for inlining (for units used via "(declare (uses ...))" or extensions
loaded via "(require-extension ...)" or "(require-library ...)").

The way this works is that yet another option "-emit-inline-file FILENAME"
writes inlining-candidates in the internal compiler tree format to a file and
the compiler (with -inline-global) looks for a suitable file named
"<unit>.inline".
These inline files can be installed together with import libs and
compiled extensions in
the local extension repository.

So it goes somewhat like this:

% csc foo.scm -emit-inline-file foo.inline   # -emit-inline-file
implies "-inline -local"
% csc bar.scm -inline-global # uses "foo", somehow

This facility hasn't been tested a lot, so one will have to experiment a
little. As chicken applications tend to use a growing number of extensions,
getting cross-module inlining to work effectively can significantly improve
performance. Any feedback is greatly appreciated.


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]