News for hackers. Stuff that matters.
Re:What is “the stack”? by eddyb on Thursday March 03, 2016 @04:53AM (#11215910)
The x87 FPU "stack" is not truly a stack though: it's rather a ring buffer of 8 registers.

And you can model it pretty well even without a "head pointer", just with moves between all registers, e.g. push(x) is ST(7) = ST(6), ST(6) = ST(5), ..., ST(1) = ST(0), ST(0) = x.

I've implemented it as such in a lifter from x86 machine code and all the redundant moves just disappear, if the uses of the pseudo-stack are balanced, and you're left with traditional registers.

There are no comments on this comment yet.