From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b1f4420d01b2c4eb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!colt.net!feeder.news-service.com!news.netfinity.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: LLVM--Low Level Virtual Machine--and Ada Date: Tue, 24 Jul 2007 14:58:03 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1184730995.862147.208590@g12g2000prg.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1185306943 25495 69.95.181.76 (24 Jul 2007 19:55:43 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 24 Jul 2007 19:55:43 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 X-Original-Bytes: 2674 Xref: g2news2.google.com comp.lang.ada:1135 Date: 2007-07-24T14:58:03-05:00 List-Id: "Duncan Sands" 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.