[fpc-pascal] Candidate for crowd-funding
ryan at thealchemistguild.com
Thu Dec 20 07:02:25 CET 2018
> On Dec 20, 2018, at 1:17 AM, Karoly Balogh (Charlie/SGR) <charlie at scenergy.dfmk.hu> wrote:
> No, that assembly function just does swapping of the stack and storing the
> caller's stack settings and setting up the coroutine's stack instead. The
> actual stack is allocated with the Win32 API function VirtualAlloc(), the
> rest is just structure copy to/from the coroutine function and setting
> up/restoring the stack. The stack is just a memory area, where the
> stackpointer points (plus on some archs it has to respect certain
> alignment requirements, but that's easy enough to deal with), and until
> your stackpointer register points to that memory area, the rest just
> works, due to how the CPU works, the compiled code just uses it... The
> compiler doesn't handle it normally on the "allocation" level, as usually
> the OS takes care of it.
It sounds like a sound theory but I don’t have the expertise to do the assembly involved for saving/restoring the stack.
I think the RTL would need some extra functions to pair with SetJmp/LongJmp but if someone could provide those I’d be happy to work on the other parts involved.
More information about the fpc-pascal