This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questions about trampolines
Robert Dewar wrote:
Øyvind Harboe wrote:
- Many backends do not support trampolines. Are trampolines
something that is ultimately being added to the backends?
We have not encountered any targets not supporting nested functions
in porting Ada to many different targets.
It's interesting that this subject was brought up.
There is a project called AVR-Ada, to add Ada to the AVR target:
<http://sourceforge.net/projects/avr-ada>
And there was recent discussion on the avr-gcc-list about the role of
nested functions which led to discussion about trampolines and Ada for
the AVR:
<http://lists.gnu.org/archive/html/avr-gcc-list/2005-03/msg00180.html>
Basically, trampolines don't work for the AVR because it is a Harvard
Architecture device.
This will also affect other similar devices, for example, the new MaxQ
target support that is going into GCC. IIRC, It's also a Harvard
Architecture device.
- Do (theoretical?) alternatives to trampolines exist? I.e. something
that does not generate code runtime.
Yes, you could have double length pointers for function pointers (pointer
to code + static link). This is the more conventional implementation, but
it introduces an overhead when not using nested functions. This overhead
is more than acceptable in Ada, where it would be very nice to get rid
of trampolines for efficiency's sake. But for C this would not be
acceptable.
Any alternatives that would work for Harvard Architecture devices such
as the AVR would be welcome.
Eric