[plt-scheme] GNU Lightning (was: Re: Improving mzc output)

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Mar 18 15:00:20 EST 2005

On Mar 14, Vadim Nasardinov wrote:
> On Mon, 2005-01-10 at 16:04 -0500, Eli Barzilay wrote in
> http://list.cs.brown.edu/pipermail/plt-scheme/2005-January/007644.html
> Message-ID: <16866.60900.887441.73781 at mojave.cs.cornell.edu>
> > 
> > Google for "GNU lightning".
> 
> Pardon my idle curiousity.  I'm wondering if you have had a chance
> to try GNU Lightning out yet, and if you have, what do you think of
> it so far?

Yes, we have a working interface that is more or less complete.  It's
working fine for what it's supposed to do.


> I hadn't heard of it until you mentioned it.  So, I asked around and
> got a response along the following lines.
> 
>   | The interface presented by GNU Lightning is pretty low-level.
>   | It's a register machine and all instructions are immediately
>   | translated to machine code via C macros.
>   | 
>   | Bad for two reasons:
>   | 
>   |   (a) too low-level to be a good JIT in its own right.

Right -- it's providing a portable low-level interface that can be
used for a JIT implementation.  It's certainly nowhere close to
*being* a JIT, and there is no intention of making it a JIT.  This is
why it doesn't do any optimizations or whatever, simply translates a
portable assembly to the platform's assembly.


>   |   (b) too high-level as a code generation tool -- abstracts the real
>   |       CPU too much.

I don't see any reason to say that.  There are certain points where
there is some overhead due to its abstraction, but there are few, and
the overhead is minimal.  In any case, the interface is such that it
would be easy to later replace it by platform dependent code that will
do things directly (except that it will suffer from similar
overheads).


>   | Any of the following would be a better choice:
>   | 
>   |   - LLVM

LLVM is inteneded as a library to write compiler backends.  It's not
something you'd want to use as a dynamic code generator.  If you know
that it could be conveniently used as a dynamic library, then please
email me more details (we can still switch).


>   |   - Mono's JIT

Big and not something I'd want to deal with (for some idological
reasons too...).


>   |   - Intel's ORP (x86 only)

I think that I vaguely heard about this, but in any case we have no
use for an x86-specific tool.


> Personally, I'm not qualified to have an opinion one way or the
> other, but I'd be curious to hear yours.  How's GNU Lightning
> stacking up against the competition?

The only serious "competition" that I have seen is LLVM, and I thought
that it has the problems I wrote about -- again, if you know that it
is a practical tool for a lightweight assembly code generation (ie,
that it can be used without all of the compiler tools, parsers etc)
then please tell me about it.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!



Posted on the users mailing list.