[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT embedding help
- From: Mike Pall <mikelu-0611@...>
- Date: Mon, 13 Nov 2006 16:38:20 +0100
Hi,
jason bright wrote:
> d- turn on the jit compiler with "require("jit.opt").start()"
>
> Everything works until i try step d). Then I get no results or C callbacks
> out of Lua when i try to run any Lua functions. No Lua errors are generated
> on any of the steps. I've been over the steps on the install instructions
> several times and can't see anything i'm missing. Any pointers appreciated!
I tried your function in a minimal test program and it worked
just fine:
int main(int argc, char **argv)
{
lua_State *L = lua_open();
luaL_openlibs(L);
InstallJITCode(L);
if (luaL_dofile(L, "mytest.lua") != 0)
fprintf(stderr, "%s\n", lua_tostring(L,-1));
lua_close(L);
return 0;
}
mytest.lua:
require("jit.opt").start()
-- Load jit/dump.lua so we get to see whether abs() is inlined.
require("jit.dump").start()
local function testopt(x) return math.abs(x) end
testopt(-1)
This should produce an assembler dump containing an "fabs"
instruction if the optimizer has been activated correctly.
Are you sure you've linked in the correct versions of opt.lua and
opt_inline.lua? Are you sure you don't get any error from Lua?
Maybe it's hidden inside some pcall()/lua_pcall(). Are you sure
you use luaL_openlibs() to load the base jit library? Have you
stripped anything from the standard Lua libraries?
Well, this is poking in the dark ... everything works fine here.
Bye,
Mike