Re: [ANN] CLX - Ahead-of-Time Lua 5.5 Compiler
Samir Tine <[email protected]> Sat, 27 Jun 2026 04:38:19 -0700 (PDT)
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the feedback ! CLX currently uses ucontext on POSIX and Fibers on Windows for coroutines. I've heard similar reports about ucontext portability issues and it's something I'll keep in mind going forward. For now it seems to work and I need more users feedback on it before changing coroutines implementation. As for Luau, I agree that static typing can be very useful. However, CLX's goal is to compile standard Lua. Luau (and Nelua too) both introduce syntax that isn't valid Lua, which goes against that goal. I'd rather keep CLX focused on Lua itself and preserve compatibility with existing Lua code. Le samedi 27 juin 2026 à 09:30:25 UTC+2, David Given a écrit : > Just so you're aware, eons ago I wrote a program which used ucontext-based > coroutines, and it was a total disaster. While it worked on *most* platforms, > there appear to be some (certain Linux architectures, I recall vaguely) > where ucontext interacted very badly with pthreads. From what I remember > the platform would do something like ALIGNUP(stackpointer, 10MB) to find > the TLS data structure for the running thread. As you might image, when > switching to a ucontext stack allocated from the heap, Very Bad Things > happened. I eventually had to give up and use threads, with a semaphore to > ensure that only one thread was executing at a time. (This was actually > pretty helpful, as I could have individual threads enter thread-safe > sections for doing certain long-running operations while allowing other > threads to execute.) > > I do note that C++20 now has a feature which it calls coroutines, except > they don't actually appear to be coroutines by any normal definition of the > word. Coroutines are apparently now called fibres. Sigh. At least there do > appear to be a number of supported fibre libraries. > > On another note: are you aware of the Luau strong-typing extension to Lua? > It was written by Roblox and is pretty good. I recent migrated my word > processor WordGrinder to it and found *so* many bugs. If I could run > Luau-annoted Lua though CLX and end up with a native executable, I would be > extremely happy. > > On Fri, 26 Jun 2026, at 18:01, [email protected] wrote: > > CLX coroutines are stackful. > > Internally they use ucontext (POSIX) or Windows Fibers (Windows), so > yielding is implemented as a context switch between execution contexts > rather than via longjmp. > > This means local state and call frames remain intact across yields. > > For native C++ modules, yielding follows the same coroutine semantics as > Lua: execution can be suspended and resumed without manually preserving > state. > > > Le 26/06/2026 08:35, 'Sewbacca' via lua-l a écrit : > > This peaks my interest: How did you implement yielding under the hood? Did > you use longjmp or did you employ a different technique? And what does > yielding mean for the C++ interface? > > ~ Sewbacca > > > -- > You received this message because you are subscribed to the Google Groups > "lua-l" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion visit > https://groups.google.com/d/msgid/lua-l/1c10d7db-e7bb-4bc0-a39c-f1e83aca1995%40kolabnow.com > <https://groups.google.com/d/msgid/lua-l/1c10d7db-e7bb-4bc0-a39c-f1e83aca1995%40kolabnow.com?utm_medium=email&utm_source=footer> > . > > > -- > You received this message because you are subscribed to the Google Groups > "lua-l" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > To view this discussion visit > https://groups.google.com/d/msgid/lua-l/9e9ffe99be701b46cc8eca4e861321de%40luart.org > <https://groups.google.com/d/msgid/lua-l/9e9ffe99be701b46cc8eca4e861321de%40luart.org?utm_medium=email&utm_source=footer> > . > > > -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/0630e2f0-3152-4ce2-8838-c18146029ea9n%40googlegroups.com.