lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Dibyendu Majumdar once stated:
> Hi,
> 
> After implementing JIT backends using LLVM and libgccjit, now it is
> time to try again!
> 
> LLVM is great at generating high performance machine code, but the
> trouble with LLVM is that it is a huge beast. gcc's JIT library still
> uses intermediate files for compilation ... so it is a JIT in name
> only.
> 
> I have been trying to figure out a way to create a small JIT backend
> that trades size for performance. Additionally, writing the backend in
> IR is tedious and errorprone, so it would be better if the backend
> could be written in a language such as C.

  What's wrong with using DynASM from LuaJIT?  That might be a good place to
start.  There's also TCC (Tiny C compiler) which can be used as a library to
compile C code directly into memory, but the license is LGPL.  I have two
modules that wraps up TCC [1] that you can look at though.

  -spc

[1]	https://github.com/spc476/lua-conmanorg/blob/master/src/tcc.c
	https://github.com/spc476/lua-conmanorg/blob/master/lua/cc.lua