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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable 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: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!cleanfeed4-b.proxad.net!nnrp20-2.free.fr!not-for-mail Return-Path: X-Virus-Scanned: amavisd-new at ada-france.org X-Greylist: delayed 172522 seconds by postgrey-1.24 at green; Fri, 20 Jul 2007 09:43:54 CEST From: Duncan Sands To: comp.lang.ada@ada-france.org Subject: Re: LLVM--Low Level Virtual Machine--and Ada Date: Fri, 20 Jul 2007 09:44:06 +0200 User-Agent: KMail/1.9.7 References: <1184730995.862147.208590@g12g2000prg.googlegroups.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Cc: Robert A Duff X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.9rc1 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.ada Message-ID: X-Leafnode-NNTP-Posting-Host: 88.191.17.134 Organization: Guest of ProXad - France NNTP-Posting-Date: 20 Jul 2007 09:45:04 MEST NNTP-Posting-Host: 88.191.14.223 X-Trace: 1184917504 news-3.free.fr 3035 88.191.14.223:52426 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:16524 Date: 2007-07-20T09:45:04+02:00 > > PS: the only thing that needed new LLVM functionality, > > i.e. functionality that didn't exist and wasn't being > > worked on, was pointers to nested functions. > > How did you implement those? > > GNAT uses trampolines, which are less than ideal > for several reasons. Hi Bob, I used trampolines. I really couldn't do it any other way without a bunch of modifications to the GNAT front-end. Also, this seems to be the only solution if you want to be able to pass such pointers to foreign language routines, which seems nice to have if not essential. The major downside I see is that they seem to be extremely expensive, presumably because you take an icache hit every time you jump to the stack. I plan to implement a bunch of small optimizations which may help, such as converting direct calls to trampolines into direct calls to the nested functions (inlining hopefully will create such direct calls). Any suggestions for a better approach than trampolines? I'm also curious to hear what the other less than ideal properties of trampolines are! Ciao, Duncan.