lua-users home
lua-l archive

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


Tim Mensch wrote:
> OK, I'll be sure to include that in the docs. I will consider shifting  
> to 2.x later, though I'm not sure that it will actually work as well for  
> us: The alternate C stacks in LuaJIT 1.x mean that people can suspend  
> their coroutines from within their C functions, and with C functions on  
> the stack. I assume that won't work in LuaJIT 2.x because of the new way  
> things work? Or am I wrong?

You're right. You can still yield across pcall(), metamethods,
iterators etc. in LuaJIT 2.x, since the VM has special provisions
for these.

But LuaJIT 2.x coroutines don't need (or get) an extra C stack and
are very lightweight. So while this solves the coroutine overhead
problem (one of the main complaints about how LuaJIT 1.x worked),
you can no longer yield/resume 'true' C frames in your own code.

If you make heavy use of this particular feature of LuaJIT 1.x,
you're effectively blocking your upgrade path. If possible, avoid
promoting it.

--Mike