[fpc-pascal] Candidate for crowd-funding
ryan at thealchemistguild.com
Wed Dec 19 15:46:01 CET 2018
> On Dec 19, 2018, at 9:28 PM, Karoly Balogh (Charlie/SGR) <charlie at 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.
More information about the fpc-pascal