lua-users home
lua-l archive

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


Hi,

Eric Jacobs wrote:
> The intentions here are to enhance the flexibility of coroutines in
> Lua without introducing any kind of platform or OS-level dependency.

Well, I have to second that. I am the author of the (machine dependent)
C coroutine patch and tried to port it to a variety of machines in the
meantime. It turns out the setjmp() kludge is quite difficult to port
to architectures with non-trivial stack frame logic, like e.g. IA64
(Itanium). And setcontext() et. al are not an alternative because of
the excessive overhead for the signal state switching syscall. The inherent
difficulty of sizing the C stacks and their memory overhead is the other
major problem.

So, yes -- I do think your solution is better. There's still some work
left modifying a number of functions and APIs (like pcall), but it is
definitely a sound approach.

> I am investigating whether this patch can be ported to 5.1...

The CallInfo struct changed quite a bit and lost the state field. And there
are a few major and several subtle changes in the control flow. But I guess
it's worth the trouble to port it to 5.1 because the incremental GC is
a necessity for many apps.

> http://lua-users.org/wiki/CoroutinesPatch

Seems it is now at: http://lua-users.org/wiki/ImprovedCoroutinesPatch

Bye,
     Mike