This series is mainly my notes on WASM research, which may be brief. The total includes:
- WebAssembly(1) Compilation
- The WebAssembly(2) Basic Api
- WebAssembly(3) Instructions
- WebAssembly(4) Validation
- WebAssembly(5) Memory
- WebAssembly(6) Binary Format
- WebAssembly(7) Future
- WebAssembly(8) Wasm in Rust (TODO)
A summary of some of the direction WASM is heading (post-MVP era) :
Overall progress list: Post MVP Features
Threads
Proposals
Multi-line is realized on the basis of Web Worker of browser and communicates through shared memory. Specific include:
- Defines a series of memory atomic operations, all of which have access order consistency. All memory atom operations should be aligned, otherwise a Trap will be triggered
- Shared Linear memory is defined. Data transfer of Webworkers is Copy semantics. Shared memory allows memory to be shared across Web workers. SharedArrayBuffer objects can be used to manipulate shared memory
- Defines Wait and Notify primitives (based on busy-wating)
Interface Types
Proposals
The main objectives are:
-
Optimizing calls to Web APIs
Can call Web API directly without JS glue code, By: Web IDL
-
Enabling “shared-nothing” linking of WebAssembly modules
Dynamic linking usually requires multiple module instances to share the same memory, table, etc., which is vulnerable.
-
Defining language-neutral interfaces like WASI
Encapsulating high-level types in different languages, such as JS string and object, works better with GC
SIMD
Proposals
Single-instruction multidata streaming means that the CPU performs the same operation on multiple data in parallel in a single statement time. SIMD can greatly improve the computing speed of applications
Simd.js existed historically but was abandoned due to implementation difficulties. The work of WASM builds on it. Specific include:
- Defines a new v128 type, binary OpCode is
0x7b
- Defines a set of instructions
Currently SIMD is close to being available, and Rust already has a corresponding package available: packed_simd
GC
Proposals
//TODO…
WASI
Github
WASI is an extension of WASM beyond the browser. For the sake of Web security and portability, a Runtime that implements the WASM standard can be much lighter, more efficient, and more secure than Docker.
If WASM+WASI existed in 2008, we wouldn’t have needed to created Docker. That’s how important it is. Webassembly on the server is the future of computing. A standardized system interface was the missing link. Let’s hope WASI is up to the task! —— Solomon Hykes, Maintainer of Docker from twitter
Further reading: hacks.mozilla.org/2019/03/sta…
Thank you
Finally thank girlfriend’s support and tolerance, pen core ❤️