Lambda the Ultimate

inactiveTopic GNU lightning
started 11/30/2001; 12:55:51 AM - last post 12/4/2001; 8:32:13 AM
Ehud Lamm - GNU lightning  blueArrow
11/30/2001; 12:55:51 AM (reads: 2903, responses: 5)
GNU lightning
(via sweetcode)

GNU lightning is a library that generates assembly language code at run-time; it is very fast, making it ideal for Just-In-Time compilers, and it abstracts over the target CPU, as it exposes to the clients a standardized RISC instruction set inspired by the MIPS and SPARC chips.

This is almost all the information found on the web site. I guess if you want more, you just got to read the source..

To much about implementation recently, any one got some cool theory papers?


Posted to implementation by Ehud Lamm on 11/30/01; 12:56:53 AM

Noel Welsh - Re: GNU lightning  blueArrow
11/30/2001; 7:38:03 AM (reads: 1737, responses: 0)
It seems to me that there is a problem with these register-based VM designs (I assume the Parrot VM mentioned in the LL1 talks is similar). Basically, to write a compiler to them a register VM you have to do all the work of normal machine-code compiler, including register allocation and instruction selection etc. and finally at the end what happens? Well, their compiler goes and does register allocation and instruction selection etc. all over again and outputs real code. So its seems like there quite a lot of duplication of effort. Wouldn't a higher level intermediate language (say a byte-code version of C-- (http://www.cminusminus.org/) be better?

Ehud Lamm - Re: GNU lightning  blueArrow
11/30/2001; 8:04:21 AM (reads: 1713, responses: 0)
So maybe you can dismiss with fancy register allocation when producing code for these VMs?

rev - Re: GNU lightning  blueArrow
12/1/2001; 2:06:58 PM (reads: 1664, responses: 0)
I believe that lightning is the JIT that is going to obsolete the current VM in GNU Smalltalk. Good to see there making it generalized, hopefully to the point that it's useful for plenty of other projects!

Jo Totland - Re: GNU lightning  blueArrow
12/4/2001; 12:02:02 AM (reads: 1574, responses: 1)
From a quick glance at the documentation (which comes with the source code) it doesn't seem to do much fancy register allocation. Basically, it treats your machine like an x86 no matter how many registers you've got, and exposes this in the interface. It abstracts calling convenctions somewhat (making it easy to use with C), but it doesn't seem easy to override them (although I only had a cursory glance at the docs, so this could be wrong).

If you need fancy register allocation algorithms, instruction selection and ordering optimized for top speed, you'd still better do it yourself. But if all you want is something cleaner and more portable than pure x86 assembly, either for prototyping a a language implementation or something else that needs runtime code-generation, this might just be what you are looking for, and should be good enough for most purposes.

Maybe a good description would be that this is a "worse is better"-approach to C-- :-)

Noel Welsh - Re: GNU lightning  blueArrow
12/4/2001; 8:32:13 AM (reads: 1620, responses: 0)
Thanks for the detailed response. If Lightning is "worse is better" to C-- does that make it C----? Which would be "A" I suppose (or a compile-time error). ;-D

[Sorry about the bad joke but someone had to make it!]