lua-users home
lua-l archive

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

De: Duncan Cross <>

Enviadas: Segunda-feira, 13 de Setembro de 2010 10:51:07

On Mon, Sep 13, 2010 at 2:35 PM, Roberto Ierusalimschy
<> wrote:
>> Some time ago we implemented a simple JIT for LPeg. That JIT was
>> orders of magnitude simpler than LuaJIT, both because LPeg code
>> is much simpler than Lua code and because our JIT did not perform
>> any extra optimization: It uses a fixed translation for each LPeg
>> instruction. The end result was around three times faster than the
>> original.

> Very interesting! I hadn't heard about this. Has the code ever been
> released? Even if there is some reason you don't feel it is
> production-ready, it sounds like an interesting thing to study.

We did not release the code of this project.
Last time I edited its source code was
about a year ago.

I put the source code of the project here:

The file lpeg.c has a function "generateprogram"
that translates the instruction of the LPEG VM to
x86 instructions.

The file test.lua is the test file that comes with
LPEG 0.9. 

I developed most of the project in a Linux-32
environment. In this environment the
JIT compiled version of LPEG passed
all the tests in test.lua.

Unfortunately, some tests failed
in my Mac-64. I commented the tests
that failed (search for "TOFIX").