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]
Other format: [Raw text]

investigation of tail calls on mainline


Marc Feeley, author of the Gambit-C Scheme->C compiler, came up with the
following test of whether GCC will implement tail call optimizations
in types of code that might typically be generated for a C virtual machine
that depends on the full implementation of tail calls.

Right now, Gambit-C and MLton, the ML compiler, rely on trampolines for
inter-module calls when targetting C in the back end.  Gambit-C uses computed
gotos for intra-module anonymous calls and returns, but has to do some extra
work on each such call to ensure that the target truly is in the same module;
MLton gave up on computed gotos a few years ago when there were still bugs in
GCC's implementation, but may look at them again after I assured them that 
computed gotos now work properly ;-).

Full implementation of tail calls would greatly speed intermodule calls
(by about a factor of 30) and would probably be no worse than a wash (compared
to computed gotos) for intra-module calls and returns.

Well, actually, "full" implementation of tail calls is not really needed,
because of the restricted forms of the possible calls needed to implement
a Gambit-style virtual machine.

Anyway, enough blather.  I took a look at the thread starting at

http://gcc.gnu.org/ml/gcc-patches/2001-01/msg00178.html

but (a) don't understand it totally and (b) don't know how much of
it still applies.

The attached file was compiled with mainline GCC and 
"-O2 -fomit-frame-pointer" on sparc-sun-solaris2.8.

Brad

Attachment: newtail.s
Description: assembler program text

Attachment: newtail.i
Description: ascii text


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