[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT with vectors
- From: Mike Pall <mikelu-1011@...>
- Date: Thu, 18 Nov 2010 17:29:52 +0100
David Given wrote:
> Do you reckon there might be any possibility of writing a version of the
> LuaJIT interpreter in C (using gcc extensions)?
This would be quite difficult, since the VM hasn't been designed
for that. It jumps directly back and forth between opcodes, the
fast functions, lots of fallback handlers, etc. The VM is fully
resumable, after all and must keep a flat C stack.
That's hard to do in C, unless you put everything in a single big
C function. But that in turn makes C compilers rather unhappy.
> This rules out the JIT, so I need an interpreter; while a C version of
> the LuaJIT interpreter is certainly going to be way slower than the
> assembler version, if it's faster than the stock Lua version I'll still
> come out ahead.
I'm not sure it would be that much faster. Some of the design
advantages might vanish if one has to compromise on too many
points. No way to find out without implementing it -- please
report the results if you do. :-)