From 3880f78016a4018e6ae6debb2ce51471e49a87f0 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 8 May 2025 14:02:32 +0200 Subject: [PATCH 1/4] [spec] Describe backwards-compatibility and reserve 0xFF opcode --- document/core/appendix/changes.rst | 33 ++++++++++++++++++++++++++++++ document/core/valid/modules.rst | 1 + 2 files changed, 34 insertions(+) diff --git a/document/core/appendix/changes.rst b/document/core/appendix/changes.rst index 1221518f77..5cb9a65f16 100644 --- a/document/core/appendix/changes.rst +++ b/document/core/appendix/changes.rst @@ -7,6 +7,39 @@ Change History Since the original release 1.0 of the WebAssembly specification, a number of proposals for extensions have been integrated. The following sections provide an overview of what has changed. +All present and future versions of WebAssembly are intended to be *backwards-compatible* with all previous versions. +Concretely: + +1. All syntactically :ref:`well-formed ` and :ref:`valid ` modules remain well-formed and valid with an equivalent :ref:`module type ` (or a subtype). + + .. note:: + This allows previously malformed or invalid modules to become legal, + e.g., by adding new features or by relaxing typing rules. + + It also allows reclassifying previously malformed modules as well-formed but invalid, + or vice versa. + + And it allows refining the typing of :ref:`imports ` and :ref:`exports `, + such that previously unlinkable modules become linkable. + +2. All non-:ref:`trapping ` :ref:`executions ` of a valid program retain their behaviour with an equivalent set of possible :ref:`results ` (or a non-empty subset). + + .. note:: + This allows previously illegal programs to become executable. + + It also allows program executions that previously trapped to execute successfully. + + And it allows reducing the set of observable behaviours of a program execution, + e.g., by reducing non-determinism. + + In a program linking prior modules with modules using new features, + a prior module may encounter new behaviours, + e.g., new forms of control flow or side effects when calling into a latter module. + +In addition, the :ref:`instruction opcode ` :math:`\hex{FF}` is considered reserved for custom use and will never be allocated to represent an instruction or instruction prefix. + + + Release 2.0 ~~~~~~~~~~~ diff --git a/document/core/valid/modules.rst b/document/core/valid/modules.rst index 9e987d79e9..26f2917b58 100644 --- a/document/core/valid/modules.rst +++ b/document/core/valid/modules.rst @@ -729,6 +729,7 @@ Imports :math:`\import` and import descriptions :math:`\importdesc` are classifi pair: validation; module single: abstract syntax; module .. _valid-module: +.. _syntax-moduletype: Modules ~~~~~~~ From 160a5f7d0da4dd8de53d640436a5f2ed7b2f2e0b Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Thu, 8 May 2025 18:06:49 +0200 Subject: [PATCH 2/4] Reword --- document/core/appendix/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/document/core/appendix/changes.rst b/document/core/appendix/changes.rst index 5cb9a65f16..476b39bdbc 100644 --- a/document/core/appendix/changes.rst +++ b/document/core/appendix/changes.rst @@ -36,7 +36,7 @@ Concretely: a prior module may encounter new behaviours, e.g., new forms of control flow or side effects when calling into a latter module. -In addition, the :ref:`instruction opcode ` :math:`\hex{FF}` is considered reserved for custom use and will never be allocated to represent an instruction or instruction prefix. +In addition, future versions of WebAssembly will not allocate the :ref:`opcode ` :math:`\hex{FF}` to represent an instruction or instruction prefix. From db0e3b674e8608832dc664333d364b6e3e279e40 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Fri, 9 May 2025 08:38:23 +0200 Subject: [PATCH 3/4] Clarify changes to text format --- document/core/appendix/changes.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/document/core/appendix/changes.rst b/document/core/appendix/changes.rst index 476b39bdbc..dd9de4c756 100644 --- a/document/core/appendix/changes.rst +++ b/document/core/appendix/changes.rst @@ -10,7 +10,7 @@ The following sections provide an overview of what has changed. All present and future versions of WebAssembly are intended to be *backwards-compatible* with all previous versions. Concretely: -1. All syntactically :ref:`well-formed ` and :ref:`valid ` modules remain well-formed and valid with an equivalent :ref:`module type ` (or a subtype). +1. All syntactically well-formed (in :ref:`binary ` or :ref:`text ` format) and :ref:`valid ` modules remain well-formed and valid with an equivalent :ref:`module type ` (or a subtype). .. note:: This allows previously malformed or invalid modules to become legal, @@ -22,6 +22,10 @@ Concretely: And it allows refining the typing of :ref:`imports ` and :ref:`exports `, such that previously unlinkable modules become linkable. + Historically, minor breaking changes to the *text format* have been allowed + that turned previously possible valid modules invalid, + as long as they were unlikely to occur in practice. + 2. All non-:ref:`trapping ` :ref:`executions ` of a valid program retain their behaviour with an equivalent set of possible :ref:`results ` (or a non-empty subset). .. note:: From 70791c4748f83251c16936fecb1be79663ca32fa Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Fri, 9 May 2025 17:58:30 +0200 Subject: [PATCH 4/4] More comments --- document/core/appendix/changes.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/document/core/appendix/changes.rst b/document/core/appendix/changes.rst index dd9de4c756..1c60dbe9b4 100644 --- a/document/core/appendix/changes.rst +++ b/document/core/appendix/changes.rst @@ -29,9 +29,10 @@ Concretely: 2. All non-:ref:`trapping ` :ref:`executions ` of a valid program retain their behaviour with an equivalent set of possible :ref:`results ` (or a non-empty subset). .. note:: - This allows previously illegal programs to become executable. + This allows previously malformed or invalid programs to become executable. - It also allows program executions that previously trapped to execute successfully. + It also allows program executions that previously trapped to execute successfully, + although the intention is to only exercise this where the possibility of such an extension has been previously noted. And it allows reducing the set of observable behaviours of a program execution, e.g., by reducing non-determinism.