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]

Re: Questions about trampolines


> > - AFAICT, the cris target is saving the value of the
> >   static chain register in the trampoline. How can that work
> >   with recursive functions? Does the cris target PASS or FAIL
> >   gcc.dg/trampoline-1.c?
> 
> It should work fine, because the trampoline is supposed to be
> built on the stack

My worry is that the trampoline is only built once, but modified
multiple times. How does the CRIS target know that the saved static
chain register does not get overwritten by recursion?

I believe that on the 6th iteration the CRIS target will fail
gcc.dg/trampoline-1.c, but I haven't got a CRIS toolchain or board to
test on. My curiosity only drives me so far. :-)

Does any other target than CRIS use a register for the static chain
that is callee saved?

> > - Lately e.g. the AMD CPU has added support for making it impossible
> >   to execute code on the stack. The town isn't big enough for
> >   both stack based trampolines and stack code execution protection. 
> >   What happens now? 
> 
> Usually it is possible to disable this stack protection. If it is not
> possible, then that's a very serious limitation.

I believe e.g. Windows XP service pack 2 has this protection enabled. 

> > - Are trampolines used for anything else but nested functions
> >   in C? I believe they are used by Ada.
> 
> They are used by both the Ada and Pascal front ends in a fundamentally
> critical way.

Zack says in his post that the Ada and Pascal nested functions do not
use trampolines. 

http://gcc.gnu.org/ml/gcc/2005-03/msg00642.html

> > - 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.

The non embedded targets seem to have trampolines, but I haven't
compiled a definite list.

Does a definitive table of what the various backends support exist?

> Well as I said above, trampolines or an equivalent are currently critically
> needed by some front ends (and of course by anyone using the (very useful IMO)
> extension of nested functions in C).

I was surprised to see trampolines in GCC code. To me they are something
inbetween traditional C and C++ objects. 

The main advantage I see of having nested functions & trampolines in C
is that they will see more testing. I think it would be really tough
for, say Ada, to rely on features in the backend that are not used at
all by C/C++.

-- 
Øyvind Harboe
http://www.zylin.com


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