https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67205

--- Comment #3 from Florian Weimer <fweimer at redhat dot com> ---
(In reply to Eric Botcazou from comment #2)
> > The attached example requires generation of trampolines.  This may be due to
> > bug 57999, but I think a front-end fix would be more reliable.
> 
> Please clarify "front-end fix".  The language requires pointers to nested
> functions in this case and you cannot reasonably change that, nested
> functions being first-class citizens in Ada.
> 
> More generally, trampolines can indeed be eliminated, but you need changes
> in the entire compiler to do it.

Couldn't you put the static chain for the dispatching subprograms into the
vtable of the tagged type?

In some examples (including this one, and those I recently submitted as a GNAT
tools patch), it seems rather straightforward to float the generic
instantiation out of the nested subprogram.  Some care is necessary to make
sure the transformation is in fact valid, but I had hoped this would be a more
localized change in the compiler.

Reply via email to