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?

1

1 Answer 1

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.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.