From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Noah Lavine Newsgroups: gmane.lisp.guile.devel Subject: Re: Lightning Bindings Date: Mon, 31 May 2010 18:49:42 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1275367110 23895 80.91.229.12 (1 Jun 2010 04:38:30 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 Jun 2010 04:38:30 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 01 06:38:28 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 1OJJFD-0002uE-M3 for guile-devel@m.gmane.org; Tue, 01 Jun 2010 06:38:27 +0200 Original-Received: from localhost ([127.0.0.1]:42381 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJJFC-00082T-GB for guile-devel@m.gmane.org; Tue, 01 Jun 2010 00:38:26 -0400 Original-Received: from [140.186.70.92] (port=58947 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJDo8-0007hT-HZ for guile-devel@gnu.org; Mon, 31 May 2010 18:50:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJDo7-0000OS-B2 for guile-devel@gnu.org; Mon, 31 May 2010 18:50:08 -0400 Original-Received: from mail-vw0-f41.google.com ([209.85.212.41]:59987) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJDo4-0000Nq-02; Mon, 31 May 2010 18:50:04 -0400 Original-Received: by vws13 with SMTP id 13so5665630vws.0 for ; Mon, 31 May 2010 15:50:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type :content-transfer-encoding:subject:date:message-id:cc:to :mime-version:x-mailer; bh=3mcABno2GnZ1G7Cw8xAz5Ku8CLR/MA1k3VTYzodxTkQ=; b=UWdZnKeTmIzP1rhvKsL8cqG8u/GiZfA/iEa2DWuZN9r3XiPjyWCQhkklcLQUr3UNkw SfYVVGMHcFp0gkRaW7Uusrx2Iv3alaThMvPJlld5vQ252LVNWLpbKmtpKbMiX7pA9NWy 97L5zULAm/oW3S1tARiYMcIt+Ay0N9DB3143I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :cc:to:mime-version:x-mailer; b=qK/9RuRevErWI5HSJF73qdLgOzdtOgkXVQsoJpU+O/xuQ/Ja5nycpgCs3+hNjhGlP9 wBjVqrVxZhAakEHNqPyeYhKSLJfp5digF9Oq4ur8Wve9Xmn0iXMl+Mbmun1SrQccCCmg lcH+HUsVMjh5JFVA6pSNbEjrGGGfLQfAEPkEI= Original-Received: by 10.224.43.100 with SMTP id v36mr1984414qae.201.1275346202237; Mon, 31 May 2010 15:50:02 -0700 (PDT) Original-Received: from [192.168.1.65] (pool-96-240-197-167.spfdma.east.verizon.net [96.240.197.167]) by mx.google.com with ESMTPS id 5sm5786180qwg.17.2010.05.31.15.49.56 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 31 May 2010 15:50:01 -0700 (PDT) X-Mailer: Apple Mail (2.1078) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Tue, 01 Jun 2010 00:38:19 -0400 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:10404 Archived-At: Hi Ludo, I didn't realize guile-lightning existed! It looks like that project = already has most of the code for Lightning bindings, so it might be = better to try to update it to work with Guile 2.0. I also saw your idea = for JIT, which I could work on as well. However, all three projects use = different ideas of how Lightning should connect to Guile, so before I = code more I would like to talk about which would be better. Here is my understanding of the three approaches: The approach in my project was to make machine code a Guile datatype, = which you could allocate with a special init function and write to with = writing functions which are just Guile versions of the Lightning macros. = It could be called as a function through the dynamic FFI. The approach in the other guile-lightning project is to represent the = Lightning code as a Guile list which mirrors the Lightning virtual = instruction set. When a list is completely built, it would then be = passed to a special function (written in C) to assemble it. It also has = some infrastructure for labels and a special method of calling these = functions, neither of which I understand yet. The approach in your plan for JIT, as I understand it, is to implement = this completely in the C layer. The machine code would be stored as part = of the representation of a procedure, and would be invisible from the = Scheme side. (I should also point out that my plan for compilation was to first start = generating machine code with as few inlined instructions as possible, = which would just call VM functions to do its work. This was also your = plan, and I believe also the plan of the earlier guile-lightning = project.) It is not clear to me which one of these is the best way, or even if = there is a best way. The reason I did not use the approach of the other guile-lightning, to = make a list and then assemble it, was that it seemed inelegant and = possibly slow to have to iterate through instructions twice whenever I = compiled something, first to generate the list and then to compile it. = However, I doubt it would be very slow, and thinking about it now it = might even be faster if the iteration programs became smaller and fit in = cache. As for doing it all in C, I am concerned about this because if there = were bindings available in Scheme, then it might be possible to write a = nice compiler in Scheme someday, which would do clever things like = inlining and interprocedural optimization. (Or, more easily, persuade = the MIT Scheme or Bigloo people to donate their compilers.) Writing it = in C could make that more difficult - but if it also made Guile programs = faster right now, then it might be worth doing anyway. What do you think of this? What way should I try to implement this? Noah=