5

I heard that Ethereum is about to change into a flavor of Web Assembly (a register-based language, eWASM). Web Assembly is register-based, which means they are faster.

So why is Ethereum using a stack-based language so far? What advantage does it have being based on a stack-based language or are there any other special reasons?

eth
  • 85,679
  • 53
  • 285
  • 406
Ho Now Nahc
  • 93
  • 1
  • 6

1 Answers1

3

A stack-based machine can be easier to implement than a register-based one, and I assume that was ultimately the decision-making factor here. The document "A Prehistory of the Ethereum Protocol" linked above hints at that.

WebAssembly is also stack-based, however the assembly is designed to be structured: blocks are explicitly terminated by an END instruction that trigger a stack clean-up. That makes the translation to register-based relatively straight-forward. That is not the case with the EVM: the stack is global, there is no such concept of code-block, and stack discrepancies can be introduced, sometimes voluntarily (compiler optimizations, etc.).

Alex Byrde
  • 601
  • 4
  • 8