Andy Wingo 3b7061323e Merge remote-tracking branch 'lightening/master' %!s(int64=5) %!d(string=hai) anos
..
lightening 3b7061323e Merge remote-tracking branch 'lightening/master' %!s(int64=5) %!d(string=hai) anos
tests acce0297ff Merge remote-tracking branch 'lightening/master' %!s(int64=5) %!d(string=hai) anos
.gitignore e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
.gitlab-ci.yml e057ea01f6 Merge remote-tracking branch 'lightening/master' %!s(int64=5) %!d(string=hai) anos
AUTHORS e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
COPYING e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
COPYING.DOC e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
COPYING.LESSER e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
ChangeLog e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
ChangeLog.lightning e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
NEWS e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
README.md e057ea01f6 Merge remote-tracking branch 'lightening/master' %!s(int64=5) %!d(string=hai) anos
THANKS e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos
lightening.am 63de1893c3 Merge remote-tracking branch 'lightening/master' %!s(int64=5) %!d(string=hai) anos
lightening.h acce0297ff Merge remote-tracking branch 'lightening/master' %!s(int64=5) %!d(string=hai) anos
lightning.texi e9be4ea73d Adapt to lightning -> lightening name change %!s(int64=6) %!d(string=hai) anos

README.md

Lightening

Lightening is a just-in-time code generation library derived from GNU Lightning, adapted to the purposes of the GNU Guile project.

Use

gcc -flto -O2 -g -o lightening.o -c lightening/lightening.c
gcc -flto -O2 -g -o my-program lightening.o my-program.c

See the GNU Lightning manual for more on how to program against Lightening (much of the details are the same).

What's the difference with GNU Lightning?

This project is called Lightening because it's lighter-weight than GNU Lightning. When you go to generate code at run-time with GNU Lightning, what happens is that you build up a graph of nodes which GNU Lightning "optimizes" before finally emitting machine code. These optimizations can improve register allocation around call sites. However they are not helpful from a Guile perspective, as they get in the way of register allocation that we need to do; and they actually prevent access to all the registers that we would like to have.

Guile needs a simple, light-weight code generation library. The GNU Lightning architecture-specific backends provide the bulk of this functionality, and Lightening wraps it all in a lightweight API.

Supported targets

Lightening can generate code for the x86-64, i686, ARMv7, and AArch64 architectures. It supports the calling conventions of MS Windows, GNU/Linux, and Mac OS.

On i686, Lightening requires SSE support. On ARMv7, we require hardware floating-point support (the VFP instructions), as well as the UDIV/SDIV instructions.

Lightening is automatically tested using GitLab's continuous integration for under the supported architectures, for GNU/Linux; for a list of recent jobs, see the CI page.

Future targets

Lightening has some inherited code from GNU Lightning for MIPS, PPC64, and s390. Patches to adapt this code to the Lightening code structure are quite welcome.

RISC-V support would be fun too.

Status

Lightening is used in GNU Guile since version 2.9.2 and seems to work well.