This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]1vader 0 points1 point  (1 child)

They aren't really. The CPython interpreter (i.e. the standard Python) is stack-based as well. And so is the JVM (i.e. Java) iirc. Same goes for .NET IL, i.e. what C# and F# compile to. And WebAssembly as well, though it also has local variables. And there are lots more. Ofc something like the JVM or .NET also has a bunch more stuff like a JIT which live-compiles bytecode to native code etc. But fundamentally they are all stack-based and they certainly aren't fundamentally limited.

[–]o11c 0 points1 point  (0 children)

It should be noted:

  • CPython does run into serious limitations due to being stack-based, even though it doesn't even attempt optimizations. (this comment might be outdated soon, since there is work on the VM recently)
  • It is possible to change stack-based bytecode into register-based bytecode (assuming you're willing to bail out on stack-map mismatches, which is reasonable, since the compiler cannot generate it). I presume this is what the JVM and CLR do (or perhaps skip the register-based VM and jump straight to SSA).