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

--- Comment #4 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> Couldn't you put the static chain for the dispatching subprograms into the
> vtable of the tagged type?

Presumably not, the vtable layout is constrained by the C++ compatibility and
this extends to local tagged types since Ada 2005.  In any case, see below.

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

The truth is, the versions of GNAT released by AdaCore use a general scheme to
eliminate (almost) all trampolines, at least on native platforms, so there is
no incentive for small tricks like this.  We could submit the scheme if there
is some interest from the community.

Reply via email to