WASM 2.0 规范

↑ 跳转到目录→ 弹出侧边栏 light dark auto W3C

WebAssembly Core Specification(WebAssembly 核心规范)

W3C Candidate Recommendation Draft,2024年12月18日 关于此文档的更多详细信息 本版本: https://www.w3.org/TR/2024/CRD-wasm-core-2-20241218/ 最新发布版本: https://www.w3.org/TR/wasm-core-2/ 编辑草案: https://webassembly.github.io/spec/core/bikeshed/ 历史: https://www.w3.org/standards/history/wasm-core-2/ 实现报告: https://webassembly.org/features/ 反馈: GitHub 编辑: Andreas Rossberg 问题追踪: GitHub Issues 版权 © 2024 World Wide Web Consortium。适用 W3C® 责任商标许可文档协议 规则。

摘要

本文档描述了核心 WebAssembly 标准的 2.0 版本,它是一种安全、可移植、低级的代码格式,旨在实现高效执行和紧凑表示。

这是相关文档集合的一部分:Core WebAssembly SpecificationWebAssembly JS InterfaceWebAssembly Web API

本文档的状态

本节描述了本文档发布时的状态。当前的 W3C 出版物列表以及本技术报告的最新版本可以在 https://www.w3.org/TR/ 的 W3C 技术报告索引 中找到。

本文档由 WebAssembly Working Group 发布,作为使用 推荐轨道的 Candidate Recommendation Draft。

作为 Candidate Recommendation 发布并不意味着 W3C 及其成员的认可。Candidate Recommendation Draft 整合了 Working Group 打算包含在后续 Candidate Recommendation Snapshot 中的先前 Candidate Recommendation 中的更改。

WebAssembly Working group 打算在 Candidate Recommendation 状态下维护此出版物,并不断将其更新为“living standard”,而不是转换为 Recommendation 状态。 在任何情况下,都不会在 2025 年 1 月 17 日之前请求 REC 过渡。

GitHub Issues 是讨论此规范的首选方式。所有问题和评论都已 存档

本文档会随时维护和更新。本文档的某些部分是正在进行的工作。

本文档由一个根据 W3C Patent Policy 运作的小组制作。W3C 维护着一份 与该小组交付成果相关的任何专利披露的公开列表;该页面还包括披露专利的说明。如果个人实际知晓其认为包含 Essential Claim(s) 的专利,则必须按照 W3C Patent Policy 的第 6 节 披露该信息。

本文档受 2023 年 11 月 3 日 W3C 流程文档 的约束。

目录

  1. 1 Introduction 1. 1.1 Introduction
    1. 1.1.1 Design Goals
    2. 1.1.2 Scope
    3. 1.1.3 Security Considerations
    4. 1.1.4 Dependencies 2. 1.2 Overview
    5. 1.2.1 Concepts
    6. 1.2.2 Semantic Phases
  2. 2 Structure 1. 2.1 Conventions
    1. 2.1.1 Grammar Notation
    2. 2.1.2 Auxiliary Notation
    3. 2.1.3 Vectors 2. 2.2 Values
    4. 2.2.1 Bytes
    5. 2.2.2 Integers
    6. 2.2.3 Floating-Point
    7. 2.2.4 Vectors
    8. 2.2.5 Names 3. 2.3 Types
    9. 2.3.1 Number Types
    10. 2.3.2 Vector Types
    11. 2.3.3 Reference Types
    12. 2.3.4 Value Types
    13. 2.3.5 Result Types
    14. 2.3.6 Function Types
    15. 2.3.7 Limits
    16. 2.3.8 Memory Types
    17. 2.3.9 Table Types
    18. 2.3.10 Global Types
    19. 2.3.11 External Types 4. 2.4 Instructions
    20. 2.4.1 Numeric Instructions
    21. 2.4.2 Vector Instructions
    22. 2.4.3 Reference Instructions
    23. 2.4.4 Parametric Instructions
    24. 2.4.5 Variable Instructions
    25. 2.4.6 Table Instructions
    26. 2.4.7 Memory Instructions
    27. 2.4.8 Control Instructions
    28. 2.4.9 Expressions 5. 2.5 Modules
    29. 2.5.1 Indices
    30. 2.5.2 Types
    31. 2.5.3 Functions
    32. 2.5.4 Tables
    33. 2.5.5 Memories
    34. 2.5.6 Globals
    35. 2.5.7 Element Segments
    36. 2.5.8 Data Segments
    37. 2.5.9 Start Function
    38. 2.5.10 Exports
    39. 2.5.11 Imports
  3. 3 Validation 1. 3.1 Conventions
    1. 3.1.1 Contexts
    2. 3.1.2 Prose Notation
    3. 3.1.3 Formal Notation 2. 3.2 Types
    4. 3.2.1 Limits
    5. 3.2.2 Block Types
    6. 3.2.3 Function Types
    7. 3.2.4 Table Types
    8. 3.2.5 Memory Types
    9. 3.2.6 Global Types
    10. 3.2.7 External Types
    11. 3.2.8 Import Subtyping 3. 3.3 Instructions
    12. 3.3.1 Numeric Instructions
    13. 3.3.2 Reference Instructions
    14. 3.3.3 Vector Instructions
    15. 3.3.4 Parametric Instructions
    16. 3.3.5 Variable Instructions
    17. 3.3.6 Table Instructions
    18. 3.3.7 Memory Instructions
    19. 3.3.8 Control Instructions
    20. 3.3.9 Instruction Sequences
    21. 3.3.10 Expressions 4. 3.4 Modules
    22. 3.4.1 Functions
    23. 3.4.2 Tables
    24. 3.4.3 Memories
    25. 3.4.4 Globals
    26. 3.4.5 Element Segments
    27. 3.4.6 Data Segments
    28. 3.4.7 Start Function
    29. 3.4.8 Exports
    30. 3.4.9 Imports
    31. 3.4.10 Modules
  4. 4 Execution 1. 4.1 Conventions
    1. 4.1.1 Prose Notation
    2. 4.1.2 Formal Notation 2. 4.2 Runtime Structure
    3. 4.2.1 Values
    4. 4.2.2 Results
    5. 4.2.3 Store
    6. 4.2.4 Addresses
    7. 4.2.5 Module Instances
    8. 4.2.6 Function Instances
    9. 4.2.7 Table Instances
    10. 4.2.8 Memory Instances
    11. 4.2.9 Global Instances
    12. 4.2.10 Element Instances
    13. 4.2.11 Data Instances
    14. 4.2.12 Export Instances
    15. 4.2.13 External Values
    16. 4.2.14 Stack
    17. 4.2.15 Administrative Instructions 3. 4.3 Numerics
    18. 4.3.1 Representations
    19. 4.3.2 Integer Operations
    20. 4.3.3 Floating-Point Operations
    21. 4.3.4 Conversions 4. 4.4 Instructions
    22. 4.4.1 Numeric Instructions
    23. 4.4.2 Reference Instructions
    24. 4.4.3 Vector Instructions
    25. 4.4.4 Parametric Instructions
    26. 4.4.5 Variable Instructions
    27. 4.4.6 Table Instructions
    28. 4.4.7 Memory Instructions
    29. 4.4.8 Control Instructions
    30. 4.4.9 Blocks
    31. 4.4.10 Function Calls
    32. 4.4.11 Expressions 5. 4.5 Modules
    33. 4.5.1 External Typing
    34. 4.5.2 Value Typing
    35. 4.5.3 Allocation
    36. 4.5.4 Instantiation
    37. 4.5.5 Invocation
  5. 5 Binary Format 1. 5.1 Conventions
    1. 5.1.1 Grammar
    2. 5.1.2 Auxiliary Notation
    3. 5.1.3 Vectors 2. 5.2 Values
    4. 5.2.1 Bytes
    5. 5.2.2 Integers
    6. 5.2.3 Floating-Point
    7. 5.2.4 Names 3. 5.3 Types
    8. 5.3.1 Number Types
    9. 5.3.2 Vector Types
    10. 5.3.3 Reference Types
    11. 5.3.4 Value Types
    12. 5.3.5 Result Types
    13. 5.3.6 Function Types
    14. 5.3.7 Limits
    15. 5.3.8 Memory Types
    16. 5.3.9 Table Types
    17. 5.3.10 Global Types 4. 5.4 Instructions
    18. 5.4.1 Control Instructions
    19. 5.4.2 Reference Instructions
    20. 5.4.3 Parametric Instructions
    21. 5.4.4 Variable Instructions
    22. 5.4.5 Table Instructions
    23. 5.4.6 Memory Instructions
    24. 5.4.7 Numeric Instructions
    25. 5.4.8 Vector Instructions
    26. 5.4.9 Expressions 5. 5.5 Modules
    27. 5.5.1 Indices
    28. 5.5.2 Sections
    29. 5.5.3 Custom Section
    30. 5.5.4 Type Section
    31. 5.5.5 Import Section
    32. 5.5.6 Function Section
    33. 5.5.7 Table Section
    34. 5.5.8 Memory Section
    35. 5.5.9 Global Section
    36. 5.5.10 Export Section
    37. 5.5.11 Start Section
    38. 5.5.12 Element Section
    39. 5.5.13 Code Section
    40. 5.5.14 Data Section
    41. 5.5.15 Data Count Section
    42. 5.5.16 Modules
  6. 6 Text Format 1. 6.1 Conventions
    1. 6.1.1 Grammar
    2. 6.1.2 Abbreviations
    3. 6.1.3 Contexts
    4. 6.1.4 Vectors 2. 6.2 Lexical Format
    5. 6.2.1 Characters
    6. 6.2.2 Tokens
    7. [6.2.3 White Space](https://www.w3.org/TR/wasm-core-2/<