The Core Specification describes the different phases an encoded module (.wasm file) undergoes when it is being utilized in a host environment (such as a web browser). This aspect of the specification represents how the output is handled and executed:
- Decoding: The binary format is converted into a module
- Validation: The decoded module undergoes validation checks (such as type checking) to ensure the module is well formed and safe
- Execution, Part 1: Instantiation: A module instance, which is the dynamic representation of the module, is instantiated by initializing the Globals, Memories, and Tables, and invokes the module's start() function
- Execution, Part 2: Invocation: Exported functions are called from the module instance:
The following diagram provides a visual representation of the semantic phases:
Semantic phases of module use