Assembly thy Web
Martin Ockajak from Zürich
Software Engineer
@martin_ockajak
Outline
●
Introduction
●
Technical details
●
Future
Introduction
What is WebAssembly
●
Virtual instruction set architecture
●
Bytecode for the web browser
●
Backed by major browser vendors
●
Formats
●
Text (Assembly Language)
●
Binary (Virtual Machine Code)
●
Evolved from its predecessors
●
Java Applets, ActiveX, PNaCl, asm.js & Emscripten @ LLVM
How does it work
Source languages
●
C / C++
●
LLVM, Emscripten, Binaryen & WABT
●
Objective-C ?
●
Swift ?
●
Rust ?
Benefits
●
Close to native performance
●
Small application size
●
Quick decoding (20x faster)
●
Portability
●
Security
Use cases
●
Image & video processing
●
Virtual & augmented reality
●
Simulation & visualization
●
Development tools
●
Games
Technical details
Formats
Instruction set
●
Integer and floating point data types
●
Basic constructs
●
Blocks
●
Typed functions
●
Calls
●
Conditionals
●
Loops
●
Type checking for direct & indirect calls
●
Similar to JVM bytecode or CIL
Memory model
●
Sandboxed linear memory
●
Can be grown programatically
●
Indexed tables
●
Typed elements
●
Indexed local & global variables
●
Mutable or immutable
Dynamic linking
●
Modules
●
Distributable units of code
●
Imports & exports
●
Module & object name
●
Integration with ES6 modules
Security
●
Indexed function calls & variables
●
Branch target validation
●
Shadow stack
●
Invalid address causes an exception
●
Same origin policy & CORS
Future
High-level features
●
Garbage collection
●
Zero-cost exceptions
●
Threads & processes
●
Tail-call optimization
●
Source maps
●
Potential source languages
●
Haskell, Scala, Python, Java, Go
Additional features
●
DOM & Web APIs access
●
Streaming compilation
●
Just-in-time compilation
●
SIMD instructions
●
Coroutines
Thank you :-)

Assembly thy Web