Comment

Comment by lifthrasiir

> It is a stack machine, no registers; instructions generally push and pop 32/64-bit ints and floats onto that stack.

One thing to note here is that WebAssembly is not just a stack machine but a stack machine encoding of an instruction tree. You can still execute it as like a stack machine but it doesn't look like a typical stack machine. In particular there are no generic stack manipulation operations at all (`drop` is the sole exception), so it is trivial to convert this encoding back to the instruction tree. This greatly simplifies the validation step.

(Edited to clarify that WebAssembly is still a stack machine, just that it lacks usual stack operations.)

parent lifthrasiir 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton