Trisha Shetty (Editor)

WebAssembly

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit
Typing discipline
  
Static

License
  
Apache License

Website
  
webassembly.org

Platform
  
Platform independent

Filename extensions
  
.wast, .wasm

WebAssembly

Paradigm
  
Imperative, Unstructured, Expression-oriented

WebAssembly or wasm is an experimental efficient low-level bytecode format for in-browser client-side scripting, which is currently in development. Its initial aim is to support compilation from C and C++, though other source languages such as Rust are also supported.

Contents

Design

WebAssembly is a portable stack machine which is designed to be faster to parse than JavaScript, as well as faster to execute.

History

WebAssembly was first announced on 17 June 2015 and on 15 March 2016 was demonstrated executing Unity's Angry Bots in Firefox, Chromium, Google Chrome, and Microsoft Edge.

Development

The initial implementation of WebAssembly support in browsers will be based on asm.js and PNaCl. After the minimum viable product (MVP) release, there are plans to support garbage collection which would make WebAssembly a compilation target for garbage collected programming languages like Java and C#. The team working on WebAssembly includes people from Mozilla, Microsoft, Google and Apple.

Representation

The WebAssembly Community Group has an initial (MVP) binary format release candidate and JavaScript API which are implemented in several browsers.

It defines a WebAssembly binary format, which is not designed to be used by humans, as well as a human-readable "Linear Assembly Bytecode" format that resembles traditional assembly languages.

The table below represents 3 different views of the same source code input from the left, as it is converted to a wasm intermediate format, then to wasm binary.

Internally at the moment the tooling of the wasm compiler system uses s-expressions (for parsing simplicity as well as extra information that "linear assembly bytecode" representation does not contain) to handle intermediate code. An example is shown below:

References

WebAssembly Wikipedia