wasm_decode_atomic (wasm v0.1.0)

View Source

The 0xFE opcode space: threads. Add an atomic instruction here.

Sixty-six instructions in four shapes, and only one of them is new to this decoder:

shapeinstructions
memory argumentevery atomic load, store and read-modify-write, and memory.atomic.wait and notify
a single zero byteatomic.fence

The 0x03 0x00 encoding of atomic.fence is the odd one. The trailing byte is a memory index reserved for a future proposal and required to be zero, so it is checked rather than skipped: a non-zero byte there is a malformed module, not a fence on another memory.

Summary

Functions

instr(R0)

-spec instr(binary()) -> {tuple() | atom(), binary()}.