> On Dec 19, 2018, at 9:28 PM, Karoly Balogh (Charlie/SGR) > <char...@scenergy.dfmk.hu> wrote: > > (After reading that old thread we had...) > > Actually, it can. The only thing you need to do is to allocate a stack > first, then make the "coroutine" functions use it, which is basically > boils down to how you pass your arguments and self instance to the > coroutine on initializatin, while you change the stack pointer register, > and then how you restore it in the end.
And how is a stack allocated? I assume we’re talking assembly here? The link I posted (http://www.festra.com/wwwboard/messages/12899.html) seems to do this but I don’t know assembly so I’m just guessing. Even if you allocated a stack frame doesn’t it need to be populated with all local variables in the current scope? In my short time working on the compiler I haven’t looked at the actual code generator so I don’t know how the stack works. However, in theory you should be able to make a compiler intrinsic that wraps this process for you. Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal