59 ms·
And just wait until you find out about Harvard architecture[1] CPUs that don't have a stack in the same sense that C has a stack—they generally have a call stac
by __david__ 11y ago
And just wait until you find out about Harvard architecture[1] CPUs that don't have a stack in the same sense that C has a stack—they generally have a call stack that is only manipulated implicitly by JSR and RET style instructions. It doesn't co-mingle return addresses with stack variables, like x86 (and von Neumann architecture[2] CPUs).
[1] https://en.wikipedia.org/wiki/Harvard_architecture https://en.wikipedia.org/wiki/Harvard_architecture
[2] https://en.wikipedia.org/wiki/Von_Neumann_architecture https://en.wikipedia.org/wiki/Von_Neumann_architecture
- dkarapetyan 11y agoAt some point I was messing around with writing a toy VM and the choice of co-mingling return addresses and what where the functions arguments felt weird to me so I split them into two different stacks. It actually worked out. I mean it meant I diverged from the book I was using to do this but that was part of the fun to see which parts were simpler and which parts were more complicated in my design. This was the book I used in case folks are curious http://www.springer.com/us/book/9783642149085 http://www.springer.com/us/book/9783642149085.
- jonsen 11y agoSee Forth, Factor a.o. which are "harvard" languages.
- gpderetta 11y agoSeparate call/local stacks is not really a property of Harvard architectures, which are distinguished by having different address spaces for code and data. The split is really orthogonal to the architecture type. IA64 is Von Neumann architecture, but still has separate stacks. In fact, at least with clang with SafeStack enabled, you can have separate stacks independently from architecture.
- __david__ 11y agoOf course our a modern CPUs have generic enough instructions that let you do that. Harvard pretty much forces it though, so much so that many Harvard CPUs don't have a way to get code into data registers and vice versa. Since they are separate busses they may be different data widths and therefor incompatible.