This is the mail archive of the mailing list for the Kawa project. See the Kawa home page for more information.

[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Kawa tail-call-elimination patches checked in

I just checked in something I've been struggling with for months:
Full tail-call-elimination support for Kawa.  Part of the complication
is that Kawa tries to do various optimizations for different
functions (for example as inlining loops), and the interaction
between the various combinations got rather hairy.  But it does
seem to work now.

There are two new flags:
	Use a calling convention that supports proper tail recursion.
	Use a calling convention that does not support proper tail recursion.
	Self-tail-recursion (i.e. a recursive call to the current function)
	is still implemented correctly, assuming that the called function
	is known at compile time.

The default is currently --no-full-tailcalls because I believe it is faster
(though I have not done any measurements yet).  It is also closer to the
Java call model, so may be better for people primarily interested in
using Kawa for scripting Java systems.

Both calling convention can co-exist:  Code compiled with --full-tailcalls
can call code compiled with --no-full-tailcalls and vice versa.

Support for full call-with-current-continuation is still missing,
but will build on the current work.

These changes are now in the Kawa cvs archive;  I want to add some
documentation and fix a few things before I make a snapshot.
(For example, the eval function is not properly tail recursive,
though apply is.)

	--Per Bothner
Cygnus Solutions