Thanks for the clear explanation Alex, Just to give some background - I've been working on the attempt to port miniPicoLisp to windows (more like making vanilla C as the only dependency). I wanted to make sure that I understood the cost of not going with assembly. Since I use https://github.com/libtom/libtommath for BigNum I think I am okay on the flags front. For the stack - I believe that Pil successfully existed without coroutines for decades right :) and I can see how I could mimic coroutines in the "user space". Somehow llvm - even though it's "industry standard" now - I feel that it imposes too much as a dependency - the very fact that it's written in c++ is a turn off for me :) Regards, Kashyap
On Wed, Mar 30, 2022 at 12:13 AM Alexander Burger <a...@software-lab.de> wrote: > Hi Kashyap, > > > I can see how you would have to end up writing the whole thing in > assembly > > - in the example you shared. Would it be right to say that its only the > > carry flag that you need or is it just an example and there are other > flags > > too? > > Pil64 used three flags (zero, sign and carry). CPUs usually have a lot more > of them, e.g. overflow, but I decided to go without them. > > Some functions returned values in one or more registers, plus some flags. > This > is much more powerful than the single return value supported by C. > > > Can I say that the need is restricted to the use of BigNum? > > On the machine instruction level, the carry is used in a lot more > situations, > like comparisons or arithmetic shifts. > > > > The ability to set/get the stack I presume needs to be compared with > > setjmp/longjmp - correct? Is setjmp/longjmp insufficient or is it not > > efficient enough? > > No, setjmp/longjmp is fine. Pil21 uses it too. But in some situations you > need > to set the stack pointer explicitly (e.g. when allocating coroutine stack > areas) > or read it (stack overflow checks). > > ☺/ A!ex > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >