From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: Lightning Bindings Date: Sat, 29 May 2010 23:39:42 +0200 Message-ID: <87fx1abd5t.fsf@gnu.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1275169215 20868 80.91.229.12 (29 May 2010 21:40:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 29 May 2010 21:40:15 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat May 29 23:40:13 2010 connect(): No such file or directory Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OITlI-0006qS-RZ for guile-devel@m.gmane.org; Sat, 29 May 2010 23:40:09 +0200 Original-Received: from localhost ([127.0.0.1]:55807 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OITlI-0007yI-0O for guile-devel@m.gmane.org; Sat, 29 May 2010 17:40:08 -0400 Original-Received: from [140.186.70.92] (port=52150 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OITlA-0007y3-Rt for guile-devel@gnu.org; Sat, 29 May 2010 17:40:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OITl9-0003Fl-NO for guile-devel@gnu.org; Sat, 29 May 2010 17:40:00 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:56203) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OITl9-0003FX-Br for guile-devel@gnu.org; Sat, 29 May 2010 17:39:59 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OITl6-0006nT-4D for guile-devel@gnu.org; Sat, 29 May 2010 23:39:56 +0200 Original-Received: from acces.bordeaux.inria.fr ([193.50.110.5]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 29 May 2010 23:39:56 +0200 Original-Received: from ludo by acces.bordeaux.inria.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 29 May 2010 23:39:56 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 57 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: acces.bordeaux.inria.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 10 Prairial an 218 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:75Mu/fnNv7ttZbcf+xhMQgRhdOo= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10398 Archived-At: Hi Noah, Noah Lavine writes: > After watching the discussion of native code generation on this list a > few weeks ago, I decided I'd like to help. I looked at several > possibilities, but it seemed like the easiest and most sure way of > making *something* work was writing bindings to GNU Lightning. Excellent! Have you looked at, ahem, guile-lightning? :-) http://cvs.savannah.gnu.org/viewvc/guile/guile-lightning/?root=guile As you can see it’s an old attempt to do this. I haven’t looked in detail, but there may be ideas or code to borrow. > My thought was to do enough of the Lightning API that it could call C > functions, and then implement a compiler from Guile VM code to native > Lightning-generated code that just called a series of VM functions. > There wouldn't be any inlining or cool things like that, but it would > be a start. You could then add inlining support for individual VM > functions as it seemed important. I had a vague plan to implement JIT in the VM using lightning in C: http://www.fdn.fr/~lcourtes/software/guile/jit.html The (presumed) advantage is that opcodes from vm-*.c could be largely reused. The obvious disadvantage is that it would be C. Writing lightning assembly can be tedious, but probably less so if done in Scheme. > - First, would you like Lightning bindings? Yes! :-) > - Second, what would a good interface to a native code generation > system be? (I'm assuming we'll want Lightning available as a regular > module in addition to using it to speed up the language.) My current > prototype just mimics the Lightning API, but it's not necessarily the > best way to do this. Is there a better way? Something close to lightning at the lowest level probably makes sense. Then there could be a higher-level interface like or close to the VM’s own assembly. Looking at it seems that you plan to have one subr for each lightning instruction. That would make the cost of assembling a single instruction quite high, compared to that of the raw lightning C macros. Thanks, Ludo’.