First bytecode compiled in Ravi/Lua
Dibyendu Majumdar
mobile@majumdar.org.uk
Thu Jan 1 00:00:00 GMT 2015
I am pleased to report that I can JIT compile the following minimal
Lua function:
x=function() return; end
I faced following problems that I had to work around:
1. libgccjit fails when there are unreachable blocks - I had to patch
libgccjit to disable this validation. As explained in my previous post
this is a show stopper issue.
2. I had to make the compiled function exported - I didn't think this
should be necessary given that the function is JIT compiled, but I
suspect it is the result of the JITed function being part of a
temporary shared library?
------------
The compiled output looks like this:
extern int
ravif1 (struct ravi_lua_State * L)
{
struct ravi_TValue * base;
struct ravi_LClosure * cl;
entry:
cl = (struct ravi_LClosure *)L->ci->func->value_.gc;
base = L->ci->u.l.base;
base = L->ci->u.l.base;
L->top = &base[(int)0];
if (cl->p->sizep > (int)0) goto <UNNAMED BLOCK 0x10109f0>; else goto
<UNNAMED BLOCK 0x100bee0>;
<UNNAMED BLOCK 0x10109f0>:
(void)luaF_close (L, base);
goto <UNNAMED BLOCK 0x100bee0>;
<UNNAMED BLOCK 0x100bee0>:
(void)luaD_poscall (L, &base[(int)0]);
return (int)1;
<UNNAMED BLOCK 0x100bb20>:
base = L->ci->u.l.base;
L->top = &base[(int)0];
if (cl->p->sizep > (int)0) goto <UNNAMED BLOCK 0x100edc0>; else goto
<UNNAMED BLOCK 0x100ef20>;
<UNNAMED BLOCK 0x100edc0>:
(void)luaF_close (L, base);
goto <UNNAMED BLOCK 0x100ef20>;
<UNNAMED BLOCK 0x100ef20>:
(void)luaD_poscall (L, &base[(int)0]);
return (int)1;
}
More information about the Jit
mailing list