comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: LLVM--Low Level Virtual Machine--and Ada
Date: Tue, 24 Jul 2007 14:58:03 -0500
Date: 2007-07-24T14:58:03-05:00	[thread overview]
Message-ID: <f85lfu$osn$1@jacob-sparre.dk> (raw)
In-Reply-To: mailman.8.1185305754.3834.comp.lang.ada@ada-france.org

"Duncan Sands" <baldrick@free.fr> wrote in message
news:mailman.8.1185305754.3834.comp.lang.ada@ada-france.org...
> Hi Randy,
>
> > > how do these thunks work?
> >
> > Generally, the compiler passes the address of the thunk to wherever it
is
> > needed, and it is called indirectly. The thunks themselves adjust the
> > parameters as needed and call the real routine.
>
> presumably pointers to nested functions are "fat pointers" containing
> both the identity of the nested function (equivalently, the identity of
> a "thunk" that knows about the nested function) and also some kind of
> pointer into the stack of the parent of the nested function.  Is that
> right?

Janus/Ada uses displays rather than static links (that was originally a
requirement of the University project that led to Janus/Ada, and we never
changed it), so in most cases, you don't need any special stack pointers.
(You only need them when you call to a place that is outside of the normal
nesting of subprograms.) There are some cases when you do need them, and in
those cases we need to provide a replacement display. That is usually saved
in a well-known place (i.e., for shared generics it is part of the generic
data block) and shared with a number of related thunks, although for
anonymous-access-to-subprogram it will be part of the pointer. Even in these
cases, we determine in the thunk how much of the display needs to be
replaced (it is often none) so as to keep the overhead to a minimum, and all
of this code is part of the thunk, not part of the call site.

                              Randy.





  reply	other threads:[~2007-07-24 19:58 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18  3:56 LLVM--Low Level Virtual Machine--and Ada Jerry
2007-07-18  7:24 ` Georg Bauhaus
2007-07-18  7:48 ` Duncan Sands
2007-07-19 14:30   ` Maxim Reznik
2007-07-19 14:56     ` Duncan Sands
     [not found]     ` <200707191656.27602.baldrick@free.fr>
2007-07-19 15:03       ` Duncan Sands
2007-07-19 21:30         ` Robert A Duff
2007-07-20  7:44           ` Duncan Sands
2007-07-20 14:06             ` Robert A Duff
2007-07-21 13:09               ` Tero Koskinen
2007-07-23  7:47               ` Duncan Sands
2007-07-24  2:12                 ` Randy Brukardt
2007-07-24  8:03                   ` Duncan Sands
2007-07-24  9:50                     ` Colin Paul Gloster
2007-07-24 10:47                       ` Markus E Leypold
2007-07-25 12:12                         ` Colin Paul Gloster
2007-07-25 12:59                           ` Markus E Leypold
2007-07-24 19:21                     ` Randy Brukardt
2007-07-24 19:36                       ` Duncan Sands
2007-07-24 19:58                         ` Randy Brukardt [this message]
2007-07-24 23:28                   ` Robert A Duff
2007-07-25  0:39                     ` Randy Brukardt
2007-07-25  2:00                       ` Robert A Duff
2007-07-25 13:14                         ` Duncan Sands
2007-07-21 22:04 ` anon
2007-07-22 13:22   ` Steve
2007-07-23 12:29   ` Colin Paul Gloster
2007-07-23 14:42     ` anon
2007-07-23 16:55       ` Markus E Leypold
2007-07-24 10:19       ` Colin Paul Gloster
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox