Skip to content

Commit c355302

Browse files
committed
Merge branch 'main' into deptup
2 parents ff43526 + eac9517 commit c355302

65 files changed

Lines changed: 24338 additions & 15388 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-spec.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@ name: CI for specs
33
on:
44
push:
55
branches: [ main, wasm-3.0 ]
6-
paths: [ .github/**, document/**, spectec/** ]
6+
paths: [ .github/**, document/**, spectec/**, specification/** ]
77

88
pull_request:
99
branches: [ main, wasm-3.0 ]
10-
paths: [ .github/**, document/**, spectec/** ]
10+
paths: [ .github/**, document/**, spectec/**, specification/** ]
1111

1212
# Allows you to run this workflow manually from the Actions tab
1313
workflow_dispatch:
1414

1515
jobs:
16+
ensure-wasm-latest:
17+
if: ${{ github.repository == 'WebAssembly/spec' }}
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repo
21+
uses: actions/checkout@v4
22+
- name: Diff wasm-latest
23+
run: bash .github/workflows/diff-wasm-latest.sh
24+
1625
build-core-spec:
1726
runs-on: ubuntu-latest
1827
steps:
@@ -145,6 +154,7 @@ jobs:
145154
publish-spec:
146155
runs-on: ubuntu-latest
147156
needs:
157+
- ensure-wasm-latest
148158
- build-core-spec
149159
- build-js-api-spec
150160
- build-web-api-spec

.github/workflows/w3c-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
push:
55
# Disable on forks!
66
branches: [ main ]
7-
paths: [ .github/**, document/** ]
7+
paths: [ .github/**, document/**, specification/** ]
88
pull_request:
9-
paths: [ .github/**, document/** ]
9+
paths: [ .github/**, document/**, specification/** ]
1010

1111
# Allows you to run this workflow manually from the Actions tab, gh CLI tool,
1212
# or REST API. THe w3c-status options correspond to the valid options for

document/core/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ SPHINXBUILD = sphinx-build
88
PAPER = a4
99
ROOTDIR = $(shell dirname `ls -d ../core 2>/dev/null || ls -d ../../core`)/..
1010
SPECTECDIR = $(ROOTDIR)/spectec
11-
SPECTECSPEC = $(ROOTDIR)/specification/wasm-3.0
11+
SPECTECSPEC = $(ROOTDIR)/specification/wasm-latest
1212
SPECTECEXT = spectec
1313
SPECTEC = $(SPECTECDIR)/spectec
1414
SPLICEDIR = _spectec
@@ -134,6 +134,7 @@ clean:
134134
rm -rf $(SPLICEDIR)
135135
rm -rf $(BUILDDIR)
136136
rm -rf $(STATICDIR)
137+
rm -rf $(SPLICEDIR)
137138
rm -f $(GENERATED)
138139

139140
.PHONY: html html-nested

document/core/appendix/index-instructions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def Instruction(version, name, opcode, type=None, validation=None, execution=Non
378378
Instruction(2.0, r'\TABLEGROW~x', r'\hex{FC}~\hex{0F}', r'[t~\X{at}] \to [\X{at}]', r'valid-table.grow', r'exec-table.grow'),
379379
Instruction(2.0, r'\TABLESIZE~x', r'\hex{FC}~\hex{10}', r'[] \to [\X{at}]', r'valid-table.size', r'exec-table.size'),
380380
Instruction(2.0, r'\TABLEFILL~x', r'\hex{FC}~\hex{11}', r'[\X{at}~t~\X{at}] \to []', r'valid-table.fill', r'exec-table.fill'),
381-
Instruction(0.0, None, r'\hex{FC}~\hex{1E} \dots'),
381+
Instruction(0.0, None, r'\hex{FC}~\hex{12} \dots'),
382382
Instruction(2.0, r'\V128.\VLOAD~x~\memarg', r'\hex{FD}~~\hex{00}', r'[\X{at}] \to [\V128]', r'valid-vload-val', r'exec-vload-val'),
383383
Instruction(2.0, r'\V128.\VLOAD\K{8x8\_s}~x~\memarg', r'\hex{FD}~~\hex{01}', r'[\X{at}] \to [\V128]', r'valid-vload-pack', r'exec-vload-pack'),
384384
Instruction(2.0, r'\V128.\VLOAD\K{8x8\_u}~x~\memarg', r'\hex{FD}~~\hex{02}', r'[\X{at}] \to [\V128]', r'valid-vload-pack', r'exec-vload-pack'),

document/core/syntax/instructions.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ The former merely returns the result of the test,
254254
while the latter performs a downcast and :ref:`traps <trap>` if the operand's type does not match.
255255

256256
.. note::
257-
The ${:BR_ON_NULL} and ${:BR_ON_NON_NULL} instructions provide versions of ${:REF.AS_NULL} that branch depending on the success of failure of a null test instead of trapping.
257+
The ${:BR_ON_NULL} and ${:BR_ON_NON_NULL} instructions provide versions of ${:REF.AS_NON_NULL} that branch depending on the success or failure of a null test instead of trapping.
258258
Similarly, the ${:BR_ON_CAST} and ${:BR_ON_CAST_FAIL} instructions provides versions of ${:REF.CAST} that branch depending on the success of the downcast instead of trapping.
259259

260260
An additional instruction operating on function references is the :ref:`control instruction <syntax-instr-control>` ${:CALL_REF}.
@@ -407,7 +407,8 @@ Instructions prefixed with ${:V128} do not involve a specific interpretation, an
407407

408408
$${syntax:
409409
vvunop vvbinop vvternop vvtestop
410-
vunop_ vbinop_ vternop_ vtestop_ vrelop_ vswizzlop_ vshiftop_ vextunop__ vextbinop__ vextternop__ vcvtop__
410+
vunop_ vbinop_ vternop_ vtestop_ vrelop_ vswizzlop_ vshiftop_
411+
vextunop__ vextbinop__ vextternop__ vcvtop__
411412
}
412413

413414
Vector instructions can be grouped into several subcategories:

document/core/text/modules.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,6 @@ The data is written as a :ref:`string <text-string>`, which may be split up into
266266

267267
$${grammar: Tdata_ Tdatastring {Tmemuse_/plain Toffset_/plain}}
268268

269-
.. note::
270-
In the current version of WebAssembly, the only valid memory index is 0
271-
or a symbolic :ref:`memory identifier <text-id>` resolving to the same value.
272-
273269

274270
Abbreviations
275271
.............

document/js-api/index.bs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ dictionary ExceptionOptions {
16831683
[LegacyNamespace=WebAssembly, Exposed=(Window,Worker,Worklet)]
16841684
interface Exception {
16851685
constructor(Tag exceptionTag, sequence&lt;any> payload, optional ExceptionOptions options = {});
1686-
any getArg([EnforceRange] unsigned long index);
1686+
any getArg(Tag exceptionTag, [EnforceRange] unsigned long index);
16871687
boolean is(Tag exceptionTag);
16881688
readonly attribute (DOMString or undefined) stack;
16891689
};
@@ -1751,9 +1751,11 @@ constructor steps are:
17511751

17521752
<div algorithm>
17531753

1754-
The <dfn method for="Exception">getArg(|index|)</dfn> method steps are:
1754+
The <dfn method for="Exception">getArg(|exceptionTag|, |index|)</dfn> method steps are:
17551755

17561756
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
1757+
1. If **this**.\[[Type]] is not equal to |exceptionTag|.\[[Address]],
1758+
1. Throw a {{TypeError}}.
17571759
1. Let |tagaddr| be [=exn_tag=](|store|, **this**.\[[Address]]).
17581760
1. Let |payload| be [=exn_read=](|store|, **this**.\[[Address]]).
17591761
1. Assert: |tagaddr| is equal to **this**.\[[Type]].
@@ -1948,7 +1950,7 @@ The <dfn abstract-op lt="CharCodeAt">CharCodeAt(|string|, |index|)</dfn> abstrac
19481950

19491951
<h4 id="js-string-cast">cast</h4>
19501952

1951-
The |funcType| of this builtin is `(rec (type (func (param externref) (result externref)))).0`.
1953+
The |funcType| of this builtin is `(rec (type (func (param externref) (result (ref extern))))).0`.
19521954

19531955
<div algorithm="js-string-cast">
19541956

@@ -1976,7 +1978,7 @@ When this builtin is invoked with parameter |v|, the following steps must be run
19761978

19771979
Let |arrayType| be `(rec (type (array (mut i16)))).0`.
19781980

1979-
The |funcType| of this builtin is `(rec (type (func (param (ref null arrayType) i32 i32) (result externref)))).0`.
1981+
The |funcType| of this builtin is `(rec (type (func (param (ref null arrayType) i32 i32) (result (ref extern))))).0`.
19801982

19811983
<div algorithm="js-string-fromCharCodeArray">
19821984

@@ -2027,7 +2029,7 @@ When this builtin is invoked with parameters |string|, |array|, and |start|, the
20272029

20282030
<h4 id="js-string-fromCharCode">fromCharCode</h4>
20292031

2030-
The |funcType| of this builtin is `(rec (type (func (param i32) (result externref)))).0`.
2032+
The |funcType| of this builtin is `(rec (type (func (param i32) (result (ref extern))))).0`.
20312033

20322034
<div algorithm="js-string-fromCharCode">
20332035

@@ -2098,7 +2100,7 @@ When this builtin is invoked with parameter |v|, the following steps must be run
20982100

20992101
<h4 id="js-string-concat">concat</h4>
21002102

2101-
The |funcType| of this builtin is `(rec (type (func (param externref externref) (result externref)))).0`.
2103+
The |funcType| of this builtin is `(rec (type (func (param externref externref) (result (ref extern))))).0`.
21022104

21032105
<div algorithm="js-string-concat">
21042106

@@ -2112,7 +2114,7 @@ When this builtin is invoked with parameters |first| and |second|, the following
21122114

21132115
<h4 id="js-string-substring">substring</h4>
21142116

2115-
The |funcType| of this builtin is `(rec (type (func (param externref i32 i32) (result externref)))).0`.
2117+
The |funcType| of this builtin is `(rec (type (func (param externref i32 i32) (result (ref extern))))).0`.
21162118

21172119
<div algorithm="js-string-substring">
21182120

specification/Makefile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ci: check-all spec-clean spec test-clean test
1111

1212
# Checking
1313

14-
check: check-3.0
14+
check: check-latest
1515

1616
check-1.0: $(EXE)
1717
$(EXE) wasm-1.0/*
@@ -28,26 +28,31 @@ check-3.0: $(EXE)
2828
@echo Wasm 3.0 spec checked OK.
2929
@echo =========================
3030

31-
check-all: check-1.0 check-2.0 check-3.0
31+
check-latest: $(EXE)
32+
$(EXE) wasm-latest/*
33+
@echo Wasm latest spec checked OK.
34+
@echo ============================
35+
36+
check-all: check-1.0 check-2.0 check-3.0 check-latest
3237
@echo All Wasm specs checked OK.
3338

3439

3540
# Build
3641

3742
spec:
3843
(cd ../document/core && make main)
39-
@echo Wasm 3.0 specs all built OK.
40-
@echo ============================
44+
@echo Wasm latest specs all built OK.
45+
@echo ===============================
4146

4247
spec-pdf:
4348
(cd ../document/core && make pdf)
44-
@echo Wasm 3.0 PDF spec built OK.
45-
@echo ===========================
49+
@echo Wasm latest PDF spec built OK.
50+
@echo ==============================
4651

4752
spec-html:
4853
(cd ../document/core && make html)
49-
@echo Wasm 3.0 HTML spec built OK.
50-
@echo ============================
54+
@echo Wasm latest HTML spec built OK.
55+
@echo ===============================
5156

5257
spec-clean:
5358
(cd ../document/core && make clean)
@@ -57,8 +62,8 @@ spec-clean:
5762

5863
test:
5964
@((cd ../spectec/src && make test) || @echo Backend tests failed. Perhaps run `make testpromote` to update test output.)
60-
@echo Wasm 3.0 backend tests ran OK.
61-
@echo ==============================
65+
@echo Wasm latest backend tests ran OK.
66+
@echo =================================
6267

6368
test-clean:
6469
@(cd ../spectec/src && make clean)

specification/diff-wasm-latest.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
# Identify the highest versioned directory
4+
HIGHEST_VER=$(ls -d specification/wasm-[0-9]* 2>/dev/null | sort -V | tail -n 1)
5+
6+
if [ -z "$HIGHEST_VER" ]; then
7+
echo "❌ Error: No wasm-X.Y versioned directories found in specification/"
8+
exit 1
9+
fi
10+
11+
LATEST="specification/wasm-latest"
12+
13+
# Check that wasm-latest exists
14+
if [ ! -d "$LATEST" ]; then
15+
echo "❌ Error: $LATEST does not exist."
16+
exit 1
17+
fi
18+
19+
# Diff the highest version with wasm-latest and check that the diff is empty
20+
echo "Checking for differences between $HIGHEST_VER and $LATEST..."
21+
22+
if diff -qr "$HIGHEST_VER" "$LATEST" > /dev/null; then
23+
echo "✅ Success: Contents match. No changes needed."
24+
else
25+
echo "🔍 Differences detected:"
26+
echo "--------------------------------"
27+
diff -r "$HIGHEST_VER" "$LATEST"
28+
echo "--------------------------------"
29+
exit 1
30+
fi

specification/wasm-3.0/1.3-syntax.instructions.spectec

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ syntax vvtestop hint(macro "%" "V%") = ANY_TRUE
102102
syntax vunop_(shape) hint(macro "%" "V%")
103103
syntax vunop_(Jnn X M) = ABS | NEG
104104
| POPCNT -- if $lsizenn(Jnn) = `8
105-
syntax vunop_(Fnn X M) = ABS | NEG | SQRT | CEIL | FLOOR | TRUNC | NEAREST
105+
syntax vunop_(Fnn X M) = ABS | NEG | SQRT
106+
| CEIL | FLOOR | TRUNC | NEAREST
106107

107108
syntax vbinop_(shape) hint(macro "%" "V%")
108109
syntax vbinop_(Jnn X M) =
@@ -116,7 +117,8 @@ syntax vbinop_(Jnn X M) =
116117
| RELAXED_Q15MULR S hint(show RELAXED_Q15MULR#_#%) -- if $lsizenn(Jnn) = `16
117118
| MIN sx hint(show MIN#_#%) -- if $lsizenn(Jnn) <= `32
118119
| MAX sx hint(show MAX#_#%) -- if $lsizenn(Jnn) <= `32
119-
syntax vbinop_(Fnn X M) = ADD | SUB | MUL | DIV | MIN | MAX | PMIN | PMAX
120+
syntax vbinop_(Fnn X M) = ADD | SUB | MUL | DIV
121+
| MIN | MAX | PMIN | PMAX
120122
| RELAXED_MIN | RELAXED_MAX
121123

122124
syntax vternop_(shape) hint(macro "%" "V%")

0 commit comments

Comments
 (0)