[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT + Pluto coroutine issue
- From: Mike Pall <mikelu-0512@...>
- Date: Mon, 5 Dec 2005 23:19:52 +0100
joe rossi wrote:
> I'm trying to integrate the Pluto project with LuaJIT.
> I have a problem that seems to come from the
> lua_resume function of LuaJITs ldo.c on this call:
> luai_userstateresume(L, nargs);
> The pluto test script crashes here when returning a
> value from a resumed coroutine. How can I get around
My first guess is that the coroutine does not get a C stack
context when resurrected by Pluto. So this is more a problem with
Coco than with LuaJIT. But LuaJIT depends on Coco ...
Replacing lua_newthread(L) with lua_newcthread(L, 0) in
unpersistthread() would recreate the C stack, but without the
contents. Alas, the C stack contains pointers to data areas and
JIT compiled code. There is no guarantee these end up on the same
addresses when restored. This is about the same level of
difficulty as persisting the stack of an arbitrary C program --
If you can arrange your code to only save/restore data structures
(and not coroutines) then the combination of LuaJIT and Pluto
would probably work -- but I haven't tested it.