W3C

WebAssembly Core Specification

W3C Working Draft 15 March 2022

This version:
https://www.w3.org/TR/2022/REC-wasm-core-20220315/
Latest published version:
https://www.w3.org/TR/wasm-core/
Latest editor's draft:
https://webassembly.github.io/spec/
Previous version:
https://www.w3.org/TR/2019/PR-wasm-core-20191205/
Editor:
Andreas Rossberg (Dfinity Stiftung)
Participate:
GitHub WebAssembly/spec
File an issue
Commit history
Pull requests

Copyright © 2022

W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply.


Abstract

This document describes version 1.1 of the core WebAssembly standard, a safe, portable, low-level code format designed for efficient execution and compact representation.

Part of a collection of related documents: the Core WebAssembly Specification, the WebAssembly JS Interface, and the WebAssembly Web API.

Status of This Document

This is a quick snapshot used for planning. This is not the spec.

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

Technical comments are welcomed by the Working Group to improve future versions of WebAssembly. GitHub Issues are preferred for discussion of this specification. When filing an issue, please put the text "wasm-core" in the title, preferably like this: "[wasm-core] …summary of comment…". All issues and comments are archived.

This document was published by the WebAssembly Working Group as a Working Draft. This document is intended to become a W3C Recommendation.

GitHub Issues are preferred for discussion of this specification. Alternatively, you can send comments to our mailing list. Please send them to [email protected] (subscribe, archives) with [wasm-core-1] at the start of your email's subject.

Publication as a Working Draft does not imply endorsement by the W3C Membership.

This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 1 August 2017 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 15 September 2020 W3C Process Document.

Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

This is required for specifications that contain normative material.

  • 1. Introduction
    • 1.1. Introduction
      • 1.1.1. Design Goals
      • 1.1.2. Scope
      • 1.1.3. Security Considerations
      • 1.1.4. Dependencies
    • 1.2. Overview
      • 1.2.1. Concepts
      • 1.2.2. Semantic Phases
  • 2. Structure
    • 2.1. Conventions
      • 2.1.1. Grammar Notation
      • 2.1.2. Auxiliary Notation
      • 2.1.3. Vectors
    • 2.2. Values
      • 2.2.1. Bytes
      • 2.2.2. Integers
      • 2.2.3. Floating-Point
      • 2.2.4. Vectors
      • 2.2.5. Names
    • 2.3. Types
      • 2.3.1. Number Types
      • 2.3.2. Vector Types
      • 2.3.3. Reference Types
      • 2.3.4. Value Types
      • 2.3.5. Result Types
      • 2.3.6. Function Types
      • 2.3.7. Limits
      • 2.3.8. Memory Types
      • 2.3.9. Table Types
      • 2.3.10. Global Types
      • 2.3.11. External Types
    • 2.4. Instructions
      • 2.4.1. Numeric Instructions
      • 2.4.2. Vector Instructions
      • 2.4.3. Reference Instructions
      • 2.4.4. Parametric Instructions
      • 2.4.5. Variable Instructions
      • 2.4.6. Table Instructions
      • 2.4.7. Memory Instructions
      • 2.4.8. Control Instructions
      • 2.4.9. Expressions
    • 2.5. Modules
      • 2.5.1. Indices
      • 2.5.2. Types
      • 2.5.3. Functions
      • 2.5.4. Tables
      • 2.5.5. Memories
      • 2.5.6. Globals
      • 2.5.7. Element Segments
      • 2.5.8. Data Segments
      • 2.5.9. Start Function
      • 2.5.10. Exports
      • 2.5.11. Imports
  • 3. Validation
    • 3.1. Conventions
      • 3.1.1. Contexts
      • 3.1.2. Prose Notation
      • 3.1.3. Formal Notation
    • 3.2. Types
      • 3.2.1. Limits
      • 3.2.2. Block Types
      • 3.2.3. Function Types
      • 3.2.4. Table Types
      • 3.2.5. Memory Types
      • 3.2.6. Global Types
      • 3.2.7. External Types
      • 3.2.8. Import Subtyping
    • 3.3. Instructions
      • 3.3.1. Numeric Instructions
      • 3.3.2. Reference Instructions
      • 3.3.3. Vector Instructions
      • 3.3.4. Parametric Instructions
      • 3.3.5. Variable Instructions
      • 3.3.6. Table Instructions
      • 3.3.7. Memory Instructions
      • 3.3.8. Control Instructions
      • 3.3.9. Instruction Sequences
      • 3.3.10. Expressions
    • 3.4. Modules
      • 3.4.1. Functions
      • 3.4.2. Tables
      • 3.4.3. Memories
      • 3.4.4. Globals
      • 3.4.5. Element Segments
      • 3.4.6. Data Segments
      • 3.4.7. Start Function
      • 3.4.8. Exports
      • 3.4.9. Imports
      • 3.4.10. Modules
  • 4. Execution
    • 4.1. Conventions
      • 4.1.1. Prose Notation
      • 4.1.2. Formal Notation
    • 4.2. Runtime Structure
      • 4.2.1. Values
      • 4.2.2. Results
      • 4.2.3. Store
      • 4.2.4. Addresses
      • 4.2.5. Module Instances
      • 4.2.6. Function Instances
      • 4.2.7. Table Instances
      • 4.2.8. Memory Instances
      • 4.2.9. Global Instances
      • 4.2.10. Element Instances
      • 4.2.11. Data Instances
      • 4.2.12. Export Instances
      • 4.2.13. External Values
      • 4.2.14. Stack
      • 4.2.15. Administrative Instructions
    • 4.3. Numerics
      • 4.3.1. Representations
      • 4.3.2. Integer Operations
      • 4.3.3. Floating-Point Operations
      • 4.3.4. Conversions
    • 4.4. Instructions
      • 4.4.1. Numeric Instructions
      • 4.4.2. Reference Instructions
      • 4.4.3. Vector Instructions
      • 4.4.4. Parametric Instructions
      • 4.4.5. Variable Instructions
      • 4.4.6. Table Instructions
      • 4.4.7. Memory Instructions
      • 4.4.8. Control Instructions
      • 4.4.9. Blocks
      • 4.4.10. Function Calls
      • 4.4.11. Expressions
    • 4.5. Modules
      • 4.5.1. External Typing
      • 4.5.2. Value Typing
      • 4.5.3. Allocation
      • 4.5.4. Instantiation
      • 4.5.5. Invocation
  • 5. Binary Format
    • 5.1. Conventions
      • 5.1.1. Grammar
      • 5.1.2. Auxiliary Notation
      • 5.1.3. Vectors
    • 5.2. Values
      • 5.2.1. Bytes
      • 5.2.2. Integers
      • 5.2.3. Floating-Point
      • 5.2.4. Names
    • 5.3. Types
      • 5.3.1. Number Types
      • 5.3.2. Vector Types
      • 5.3.3. Reference Types
      • 5.3.4. Value Types
      • 5.3.5. Result Types
      • 5.3.6. Function Types
      • 5.3.7. Limits
      • 5.3.8. Memory Types
      • 5.3.9. Table Types
      • 5.3.10. Global Types
    • 5.4. Instructions
      • 5.4.1. Control Instructions
      • 5.4.2. Reference Instructions
      • 5.4.3. Parametric Instructions
      • 5.4.4. Variable Instructions
      • 5.4.5. Table Instructions
      • 5.4.6. Memory Instructions
      • 5.4.7. Numeric Instructions
      • 5.4.8. Vector Instructions
      • 5.4.9. Expressions
    • 5.5. Modules
      • 5.5.1. Indices
      • 5.5.2. Sections
      • 5.5.3. Custom Section
      • 5.5.4. Type Section
      • 5.5.5. Import Section
      • 5.5.6. Function Section
      • 5.5.7. Table Section
      • 5.5.8. Memory Section
      • 5.5.9. Global Section
      • 5.5.10. Export Section
      • 5.5.11. Start Section
      • 5.5.12. Element Section
      • 5.5.13. Code Section
      • 5.5.14. Data Section
      • 5.5.15. Data Count Section
      • 5.5.16. Modules
  • 6. Text Format
    • 6.1. Conventions
      • 6.1.1. Grammar
      • 6.1.2. Abbreviations
      • 6.1.3. Contexts
      • 6.1.4. Vectors
    • 6.2. Lexical Format
      • 6.2.1. Characters
      • 6.2.2. Tokens
      • 6.2.3. White Space
      • 6.2.4. Comments
    • 6.3. Values
      • 6.3.1. Integers
      • 6.3.2. Floating-Point
      • 6.3.3. Strings
      • 6.3.4. Names
      • 6.3.5. Identifiers
    • 6.4. Types
      • 6.4.1. Number Types
      • 6.4.2. Vector Types
      • 6.4.3. Reference Types
      • 6.4.4. Value Types
      • 6.4.5. Function Types
      • 6.4.6. Limits
      • 6.4.7. Memory Types
      • 6.4.8. Table Types
      • 6.4.9. Global Types
    • 6.5. Instructions
      • 6.5.1. Labels
      • 6.5.2. Control Instructions
      • 6.5.3. Reference Instructions
      • 6.5.4. Parametric Instructions
      • 6.5.5. Variable Instructions
      • 6.5.6. Table Instructions
      • 6.5.7. Memory Instructions
      • 6.5.8. Numeric Instructions
      • 6.5.9. Vector Instructions
      • 6.5.10. Folded Instructions
      • 6.5.11. Expressions
    • 6.6. Modules
      • 6.6.1. Indices
      • 6.6.2. Types
      • 6.6.3. Type Uses
      • 6.6.4. Imports
      • 6.6.5. Functions
      • 6.6.6. Tables
      • 6.6.7. Memories
      • 6.6.8. Globals
      • 6.6.9. Exports
      • 6.6.10. Start Function
      • 6.6.11. Element Segments
      • 6.6.12. Data Segments
      • 6.6.13. Modules
  • 7. Appendix
    • 7.1. Embedding
      • 7.1.1. Types
      • 7.1.2. Errors
      • 7.1.3. Pre- and Post-Conditions
      • 7.1.4. Store
      • 7.1.5. Modules
      • 7.1.6. Module Instances
      • 7.1.7. Functions
      • 7.1.8. Tables
      • 7.1.9. Memories
      • 7.1.10. Globals
    • 7.2. Implementation Limitations
      • 7.2.1. Syntactic Limits
      • 7.2.2. Validation
      • 7.2.3. Execution
    • 7.3. Validation Algorithm
      • 7.3.1. Data Structures
      • 7.3.2. Validation of Opcode Sequences
    • 7.4. Custom Sections
      • 7.4.1. Name Section
    • 7.5. Soundness
      • 7.5.1. Results
      • 7.5.2. Store Validity
      • 7.5.3. Configuration Validity
      • 7.5.4. Administrative Instructions
      • 7.5.5. Store Extension
      • 7.5.6. Theorems
    • 7.6. Change History
      • 7.6.1. Release 1.1
  • 7.7. Index of Types
  • 7.8. Index of Instructions
  • 7.9. Index of Semantic Rules
    • 7.9.1. Typing of Static Constructs
    • 7.9.2. Typing of Runtime Constructs
    • 7.9.3. Constantness
    • 7.9.4. Matching
    • 7.9.5. Store Extension
    • 7.9.6. Execution
© Copyright 2017, WebAssembly Community Group. Last updated on 2022-03-15.