All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

Why WebAssembly isn't truly a stack machine: A technical analysis

By

signa11

1mo ago· 5 min readenInsight

Summary

The article challenges the common characterization of WebAssembly (Wasm) as a stack machine. The author, after hand-writing Wasm code, discovered a fundamental difference between Wasm and traditional stack-based languages. While Wasm uses a stack for instruction operands, it differs from classic stack machines in key ways that make the "stack machine" label misleading. The article explores the distinction between register-based and stack-based architectures, arguing that Wasm's design has important structural differences from other stack-based languages.

Key quotes

· 3 pulled
Everyone knows Wasm is a stack machine. Wikipedia says so, the official Wasm design specification says so, you get it. I thought so too.
That is, until I started writing Wasm code – not compiling for Wasm, but writing the instructions by hand. And I found out that there exists a major difference between Wasm and all other stack-based languages, that makes this claim misleading.
What is a stack machine, even?
Snippet from the RSS feed
Everyone knows Wasm is a stack machine. Wikipedia says so, the official Wasm design specification says so, you get it. I thought so too. That is, until I started writing Wasm code – not compiling for Wasm, but writing the instructions by hand. And I found

You might also wanna read