lua-users home
lua-l archive

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


It was thus said that the Great Tim Hill once stated:
> 
> 
> > On Jan 25, 2020, at 4:15 PM, Sean Conner <sean@conman.org> wrote:
> > 
> > The Lua call stack and C call stack are two separate things.  The Lua VM
> > does not use longjmp() to implement coroutines [a][d].
> 
> Really? I can’t look at the code right now, but I’d always assumed that
> Lua always used longjmp (as per the OPs point). How can it do otherwise?
> At any time a Lua state can have any number of intermixed C and Lua
> frames, and while you are correct in that they dont share the same stack,
> Lua needs to resume by longjmp to make sure the C stack corresponds to the
> Lua coroutine state. While I can see that Lua *might* optimize out this
> condition if it knows there are NO C calls on either coroutine stack, I’m
> not sure that it does that?

  I was mistaken.

  -spc