News for hackers. Stuff that matters.
Re:Ask HN: Why did stack-based CPUs lose out? by musicale on Sunday January 01, 2023 @03:21AM (#34204638)
I think Burroughs mainframes also used stack architectures. I suspect the architecture wasn't entirely responsible for Burroughs' demise, but they seem to be an outlier.

I imagine one potential problem with stack architectures is running out of stack memory and having to spill to main memory. (Presumably using main memory for the stack would be too slow.) This seems unlikely for a single thread but I could imagine it being a big issue with thousands of threads. Context switches where you have to save the whole stack to memory are going to be more like cache misses or page faults.

Another potential issue might be dealing with data that isn't on the top of the stack. A solution could be to add a deep stack addressing mode but then you're basically mixing in a register machine and the simplicity and orthogonality might be lost.

The interesting thing to me is that several stack-oriented interpreters, compilers, and runtimes (including Forth, Pascal, Smalltalk, Java, and WebAssembly systems) have been developed, so maybe a stack-based CPU might be a good match for those systems.

Re:Ask HN: Why did stack-based CPUs lose out? by 082349872349872 on Sunday January 01, 2023 @04:09AM (#34204854)
Stack-orientation makes sense for interpreters, because decode is expensive in software. Hardware has different tradeoffs.
Re:Ask HN: Why did stack-based CPUs lose out? by Morpholemew on Sunday January 01, 2023 @10:26AM (#34207018)
The theory that stacks are better than registers for an interpreter was pretty conclusively disproven by the Lua 5.0 interpreter. See https://www.lua.org/doc/jucs05.pdf (summary: although decode is slightly more expensive per opcode, you have half as many opcodes to decode on average because you get rid of all the stack manipulation instructions)
Re:Ask HN: Why did stack-based CPUs lose out? by Taniwha on Sunday January 01, 2023 @05:39AM (#34205280)
The Burroughs mainframes stored most of their stacks in main memory - they have a couple of deep stack addressing modes (and a proper set of display registers).

Alternately 29Ks and Sparcs have register windows which are essentially top of stack caches.

I think that the RTXs were a thing at a particular point of time that made sense before caches moved on-chip, they didn't catch because they expected you to buy into the forth world-view (rather than providing C and other languages of the day)