4 ms·
When Burroughs started experimenting with stack processors in their B5000 computer, they didn't do it for code size but the ability to use high level languages
by rahen 4y ago
When Burroughs started experimenting with stack processors in their B5000 computer, they didn't do it for code size but the ability to use high level languages first, going as far as to hide assembly language to the user. Compilers are fairly straightforward to write on such an architecture, and can produce reasonably fast machine code in one pass.
A register based CPU make this quite more complex, and is indeed a more performant but less elegant approach than a stack based CPU.
This later inspired HP for the HP 3000 and then its RPN calculators, as well as other, lesser known machines. Nowadays I think I've only seen this with the JVM (to reduce the IL size) and a couple MCUs.
- retrac 4y agoStack-based VMs are more common than just the JVM. Python and Ruby's bytecodes are stack-oriented. Stack machines are also still common for compilers where "good enough" code is acceptable. As you say, it's relatively easy to write a code generator for a stack machine.
- int_19h 4y agoCIL (.NET bytecode) is also stack-based, and perhaps the most interesting modern incarnation as well, because it is sufficiently full featured - pointers w/arithmetic, unions, stackalloc etc - to be a target for a C compiler.
- pjmlp 4y agoNo wonder, given that supporting C++ was one of its design goals, first with Managed C++ Extensions, followed by C++/CLI on .NET 2.0.
- cmrdporcupine 4y agoWebAssembly is explicitly a stack computing model. Even purer than the JVM, as it is quite a bit lower level, with no types/objects other than primitive scalars, and no garbage collection or other runtime services (yet), just a simple linear memory model.
- kaba0 4y agoI am not too familiar with WASM, but isn’t it expression-tree-based that happens to have a stack-like flattening as well? I remember reading something like that here, and afaik it only has structured control flow (no gotos). The JVM just happens to have some higher level primitives, but WASM is not really stack-based in the same way at all.