unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: Re: Lightning Bindings
Date: Sat, 29 May 2010 23:39:42 +0200	[thread overview]
Message-ID: <87fx1abd5t.fsf@gnu.org> (raw)
In-Reply-To: AANLkTinTI38-V8uMypfedTN9vZ-HVRFihWbiXQSLJ2gV@mail.gmail.com

Hi Noah,

Noah Lavine <noah.b.lavine@gmail.com> 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
<http://cvs.savannah.gnu.org/viewvc/guile/guile-lightning/compiler.scm?revision=1.3&root=guile&view=markup>
or close to the VM’s own assembly.

Looking at
<http://github.com/noahl/guile-lightning/blob/master/binds.scm> 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’.




  parent reply	other threads:[~2010-05-29 21:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 21:03 Lightning Bindings Noah Lavine
2010-05-28 20:49 ` No Itisnt
2010-05-28 21:38   ` Noah Lavine
2010-05-29 20:09 ` Thien-Thi Nguyen
2010-06-01 14:57   ` Noah Lavine
2010-06-01 17:55     ` Ludovic Courtès
2010-06-02 20:47     ` Thien-Thi Nguyen
2010-05-29 21:39 ` Ludovic Courtès [this message]
2010-06-01  9:06 ` Andy Wingo
2010-06-01 14:55   ` Noah Lavine
2010-06-01 19:24     ` Andy Wingo
  -- strict thread matches above, loose matches on Subject: below --
2010-05-31 22:49 Noah Lavine
2010-06-01  9:15 ` Andy Wingo
2010-06-01 18:02 ` Ludovic Courtès
2010-06-01 20:42 Noah Lavine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fx1abd5t.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).