https://www.w3.org/TR/wasm-core-2/ W3C WebAssembly Core Specification Version 2.0 W3C First Public Working Draft 19 April 2022 More details about this document This version: https://www.w3.org/TR/2022/WD-wasm-core-2-20220419/ Latest published version: https://www.w3.org/TR/wasm-core-2/ Latest editor's draft: https://webassembly.github.io/spec/core/ History: https://www.w3.org/standards/history/wasm-core-2 Commit history Latest Recommendation: https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/ Editor: Andreas Rossberg (Dfinity Stiftung) Feedback: GitHub WebAssembly/spec (pull requests, new issue, open issues) public-webassembly@w3.org with subject line [wasm-core] (archives ) Browser support: caniuse.com Copyright (c) 2022 W3C^(r) (MIT, ERCIM, Keio, Beihang). W3C liability, trademark and permissive document license rules apply. --------------------------------------------------------------------- Abstract This document describes version 2.0 of the core WebAssembly standard, a safe, portable, low-level code format designed for efficient execution and compact representation. WebAseembly Core is part of a collection of WebAssembly specifications: the Core WebAssembly Specification, the WebAssembly JS Interface, and the WebAssembly Web API. Status of This Document This section describes the status of this document at the time of its publication. 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 First Public Working Draft using the Recommendation track. Publication as a First Public Working Draft does not imply endorsement by W3C and its Members. 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 2 November 2021 W3C Process Document . Table of Contents 1. 1Introduction + 1.1Introduction o 1.1.1Design Goals o 1.1.2Scope o 1.1.3Security Considerations o 1.1.4Dependencies + 1.2Overview o 1.2.1Concepts o 1.2.2Semantic Phases 2. 2Structure + 2.1Conventions o 2.1.1Grammar Notation o 2.1.2Auxiliary Notation o 2.1.3Vectors + 2.2Values o 2.2.1Bytes o 2.2.2Integers o 2.2.3Floating-Point o 2.2.4Vectors o 2.2.5Names + 2.3Types o 2.3.1Number Types o 2.3.2Vector Types o 2.3.3Reference Types o 2.3.4Value Types o 2.3.5Result Types o 2.3.6Function Types o 2.3.7Limits o 2.3.8Memory Types o 2.3.9Table Types o 2.3.10Global Types o 2.3.11External Types + 2.4Instructions o 2.4.1Numeric Instructions o 2.4.2Vector Instructions o 2.4.3Reference Instructions o 2.4.4Parametric Instructions o 2.4.5Variable Instructions o 2.4.6Table Instructions o 2.4.7Memory Instructions o 2.4.8Control Instructions o 2.4.9Expressions + 2.5Modules o 2.5.1Indices o 2.5.2Types o 2.5.3Functions o 2.5.4Tables o 2.5.5Memories o 2.5.6Globals o 2.5.7Element Segments o 2.5.8Data Segments o 2.5.9Start Function o 2.5.10Exports o 2.5.11Imports 3. 3Validation + 3.1Conventions o 3.1.1Contexts o 3.1.2Prose Notation o 3.1.3Formal Notation + 3.2Types o 3.2.1Limits o 3.2.2Block Types o 3.2.3Function Types o 3.2.4Table Types o 3.2.5Memory Types o 3.2.6Global Types o 3.2.7External Types o 3.2.8Import Subtyping + 3.3Instructions o 3.3.1Numeric Instructions o 3.3.2Reference Instructions o 3.3.3Vector Instructions o 3.3.4Parametric Instructions o 3.3.5Variable Instructions o 3.3.6Table Instructions o 3.3.7Memory Instructions o 3.3.8Control Instructions o 3.3.9Instruction Sequences o 3.3.10Expressions + 3.4Modules o 3.4.1Functions o 3.4.2Tables o 3.4.3Memories o 3.4.4Globals o 3.4.5Element Segments o 3.4.6Data Segments o 3.4.7Start Function o 3.4.8Exports o 3.4.9Imports o 3.4.10Modules 4. 4Execution + 4.1Conventions o 4.1.1Prose Notation o 4.1.2Formal Notation + 4.2Runtime Structure o 4.2.1Values o 4.2.2Results o 4.2.3Store o 4.2.4Addresses o 4.2.5Module Instances o 4.2.6Function Instances o 4.2.7Table Instances o 4.2.8Memory Instances o 4.2.9Global Instances o 4.2.10Element Instances o 4.2.11Data Instances o 4.2.12Export Instances o 4.2.13External Values o 4.2.14Stack o 4.2.15Administrative Instructions + 4.3Numerics o 4.3.1Representations o 4.3.2Integer Operations o 4.3.3Floating-Point Operations o 4.3.4Conversions + 4.4Instructions o 4.4.1Numeric Instructions o 4.4.2Reference Instructions o 4.4.3Vector Instructions o 4.4.4Parametric Instructions o 4.4.5Variable Instructions o 4.4.6Table Instructions o 4.4.7Memory Instructions o 4.4.8Control Instructions o 4.4.9Blocks o 4.4.10Function Calls o 4.4.11Expressions + 4.5Modules o 4.5.1External Typing o 4.5.2Value Typing o 4.5.3Allocation o 4.5.4Instantiation o 4.5.5Invocation 5. 5Binary Format + 5.1Conventions o 5.1.1Grammar o 5.1.2Auxiliary Notation o 5.1.3Vectors + 5.2Values o 5.2.1Bytes o 5.2.2Integers o 5.2.3Floating-Point o 5.2.4Names + 5.3Types o 5.3.1Number Types o 5.3.2Vector Types o 5.3.3Reference Types o 5.3.4Value Types o 5.3.5Result Types o 5.3.6Function Types o 5.3.7Limits o 5.3.8Memory Types o 5.3.9Table Types o 5.3.10Global Types + 5.4Instructions o 5.4.1Control Instructions o 5.4.2Reference Instructions o 5.4.3Parametric Instructions o 5.4.4Variable Instructions o 5.4.5Table Instructions o 5.4.6Memory Instructions o 5.4.7Numeric Instructions o 5.4.8Vector Instructions o 5.4.9Expressions + 5.5Modules o 5.5.1Indices o 5.5.2Sections o 5.5.3Custom Section o 5.5.4Type Section o 5.5.5Import Section o 5.5.6Function Section o 5.5.7Table Section o 5.5.8Memory Section o 5.5.9Global Section o 5.5.10Export Section o 5.5.11Start Section o 5.5.12Element Section o 5.5.13Code Section o 5.5.14Data Section o 5.5.15Data Count Section o 5.5.16Modules 6. 6Text Format + 6.1Conventions o 6.1.1Grammar o 6.1.2Abbreviations o 6.1.3Contexts o 6.1.4Vectors + 6.2Lexical Format o 6.2.1Characters o 6.2.2Tokens o 6.2.3White Space o 6.2.4Comments + 6.3Values o 6.3.1Integers o 6.3.2Floating-Point o 6.3.3Strings o 6.3.4Names o 6.3.5Identifiers + 6.4Types o 6.4.1Number Types o 6.4.2Vector Types o 6.4.3Reference Types o 6.4.4Value Types o 6.4.5Function Types o 6.4.6Limits o 6.4.7Memory Types o 6.4.8Table Types o 6.4.9Global Types + 6.5Instructions o 6.5.1Labels o 6.5.2Control Instructions o 6.5.3Reference Instructions o 6.5.4Parametric Instructions o 6.5.5Variable Instructions o 6.5.6Table Instructions o 6.5.7Memory Instructions o 6.5.8Numeric Instructions o 6.5.9Vector Instructions o 6.5.10Folded Instructions o 6.5.11Expressions + 6.6Modules o 6.6.1Indices o 6.6.2Types o 6.6.3Type Uses o 6.6.4Imports o 6.6.5Functions o 6.6.6Tables o 6.6.7Memories o 6.6.8Globals o 6.6.9Exports o 6.6.10Start Function o 6.6.11Element Segments o 6.6.12Data Segments o 6.6.13Modules 7. 7Appendix + 7.1Embedding o 7.1.1Types o 7.1.2Errors o 7.1.3Pre- and Post-Conditions o 7.1.4Store o 7.1.5Modules o 7.1.6Module Instances o 7.1.7Functions o 7.1.8Tables o 7.1.9Memories o 7.1.10Globals + 7.2Implementation Limitations o 7.2.1Syntactic Limits o 7.2.2Validation o 7.2.3Execution + 7.3Validation Algorithm o 7.3.1Data Structures o 7.3.2Validation of Opcode Sequences + 7.4Custom Sections o 7.4.1Name Section + 7.5Soundness o 7.5.1Results o 7.5.2Store Validity o 7.5.3Configuration Validity o 7.5.4Administrative Instructions o 7.5.5Store Extension o 7.5.6Theorems + 7.6Change History o 7.6.1Release 1.1 1. 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. 2. Security Considerations See section 1.1.3 Security Considerations 3. Privacy Considerations See section 1.1.3 Security Considerations |