[fpc-pascal] Coroutines and VirtualAlloc
pascaldragon at googlemail.com
Wed Apr 19 11:34:19 CEST 2017
Am 19.04.2017 11:26 schrieb "Ryan Joseph" <ryan at thealchemistguild.com>:
> > On Apr 19, 2017, at 4:14 PM, Sven Barth via fpc-pascal <
fpc-pascal at lists.freepascal.org> wrote:
> > Those functions simply store (setjmp) and restore (longjmp) register
values (and setjmp also returns the value passed to longjmp if it had been
reached by a longjmp). Nothing more, nothing less. So while the stack
register while be changed, the contents on the stack will not.
> Why doesn’t “i” in my example increment? The value keeps going back to 1
even after I used += 1 so its like the old copy of the stack before the
jump got pushed back on top and it started over. I don’t understand how
assembly works but I thought it would just start over and the state of the
stack in that function would still be the same as before so I could keep
adding 1 every pass.
Ah, I didn't catch that earlier. Probably "i" is kept in a register due to
optimization. You should check the generated assembler code to be sure.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal