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:
> On 23 June 2018 at 20:51, Soni "They/Them" L. <fakedme@gmail.com> wrote:
> > Would it be possible to implement CC-JIT support?
> 
> If you mean compiling with external compiler then yes I suppose so,
> but that would mean creating some kind of shared library and loading
> code from that ... pretty inefficient.

  There's always TCC [1], a library which can compile code into memory that
can be called directly.  I have a Lua wrapper for it [2] and code on top of
that that allows the loading of C based modules directly from source code
[3], as well as making an easy to use API for compiling C code.

  On the good side, TCC compliles *fast* [4].  On the down side, the code it
produces is *not fast*.  It's a trade off.  And it's fun to play with.

  -spc

[1]	http://repo.or.cz/w/tinycc.git

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

[3]	https://github.com/spc476/lua-conmanorg/blob/master/lua/cc.lua

[4]	There was an older version that could boot the Linux kernel, from
	source code, in under 10 seconds.