diff --git a/Makefile b/Makefile index 90ae6acd..a709cb2e 100644 --- a/Makefile +++ b/Makefile @@ -123,7 +123,9 @@ spectest_v2_testdata_dir := $(spectest_v2_dir)/testdata spec_version_v2 := 1782235239ddebaf2cb079b00fdaa2d2c4dedba3 spectest_threads_dir := $(spectest_base_dir)/threads spectest_threads_testdata_dir := $(spectest_threads_dir)/testdata -spec_version_threads := cc01bf0d17ba3fb1dc59fb7c5c725838aff18b50 +# From https://github.com/WebAssembly/threads/tree/upstream-rebuild which has not been merged to main yet. +# It will likely be renamed to main in the future - https://github.com/WebAssembly/threads/issues/216. +spec_version_threads := 3635ca51a17e57e106988846c5b0e0cc48ac04fc .PHONY: build.spectest build.spectest: @@ -174,9 +176,6 @@ build.spectest.threads: @mkdir -p $(spectest_threads_testdata_dir) @cd $(spectest_threads_testdata_dir) \ && curl -sSL 'https://api.github.com/repos/WebAssembly/threads/contents/test/core?ref=$(spec_version_threads)' | jq -r '.[]| .download_url' | grep -E "atomic.wast" | xargs -Iurl curl -sJL url -O -# Fix broken CAS spectests -# https://github.com/WebAssembly/threads/issues/195#issuecomment-1318429506 - @cd $(spectest_threads_testdata_dir) && patch < ../atomic.wast.patch @cd $(spectest_threads_testdata_dir) && for f in `find . -name '*.wast'`; do \ wast2json --enable-threads --debug-names $$f; \ done diff --git a/internal/integration_test/spectest/threads/atomic.wast.patch b/internal/integration_test/spectest/threads/atomic.wast.patch deleted file mode 100644 index 6b60b7fa..00000000 --- a/internal/integration_test/spectest/threads/atomic.wast.patch +++ /dev/null @@ -1,49 +0,0 @@ -diff --git a/internal/integration_test/spectest/threads/testdata/atomic.wast b/internal/integration_test/spectest/threads/testdata/atomic.wast -index 66ad0ebb..40259a9a 100644 ---- a/internal/integration_test/spectest/threads/testdata/atomic.wast -+++ b/internal/integration_test/spectest/threads/testdata/atomic.wast -@@ -324,7 +324,7 @@ - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i32.atomic.rmw8.cmpxchg_u" (i32.const 0) (i32.const 0x11111111) (i32.const 0xcdcdcdcd)) (i32.const 0x11)) --(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) -+(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111111111cd)) - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i32.atomic.rmw16.cmpxchg_u" (i32.const 0) (i32.const 0) (i32.const 0xcafecafe)) (i32.const 0x1111)) -@@ -332,7 +332,7 @@ - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i32.atomic.rmw16.cmpxchg_u" (i32.const 0) (i32.const 0x11111111) (i32.const 0xcafecafe)) (i32.const 0x1111)) --(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) -+(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111cafe)) - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i64.atomic.rmw8.cmpxchg_u" (i32.const 0) (i64.const 0) (i64.const 0x4242424242424242)) (i64.const 0x11)) -@@ -340,7 +340,7 @@ - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i64.atomic.rmw8.cmpxchg_u" (i32.const 0) (i64.const 0x1111111111111111) (i64.const 0x4242424242424242)) (i64.const 0x11)) --(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) -+(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111142)) - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i64.atomic.rmw16.cmpxchg_u" (i32.const 0) (i64.const 0) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) -@@ -348,7 +348,7 @@ - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i64.atomic.rmw16.cmpxchg_u" (i32.const 0) (i64.const 0x1111111111111111) (i64.const 0xbeefbeefbeefbeef)) (i64.const 0x1111)) --(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) -+(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x111111111111beef)) - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i64.atomic.rmw32.cmpxchg_u" (i32.const 0) (i64.const 0) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) -@@ -356,7 +356,7 @@ - - (invoke "init" (i64.const 0x1111111111111111)) - (assert_return (invoke "i64.atomic.rmw32.cmpxchg_u" (i32.const 0) (i64.const 0x1111111111111111) (i64.const 0xcabba6e5cabba6e5)) (i64.const 0x11111111)) --(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x1111111111111111)) -+(assert_return (invoke "i64.atomic.load" (i32.const 0)) (i64.const 0x11111111cabba6e5)) - - ;; *.atomic.rmw*.cmpxchg (compare true) - diff --git a/internal/integration_test/spectest/threads/testdata/atomic.json b/internal/integration_test/spectest/threads/testdata/atomic.json index 3da85baa..c8babfa3 100644 --- a/internal/integration_test/spectest/threads/testdata/atomic.json +++ b/internal/integration_test/spectest/threads/testdata/atomic.json @@ -276,54 +276,54 @@ {"type": "assert_return", "line": 496, "action": {"type": "invoke", "field": "memory.atomic.notify", "args": [{"type": "i32", "value": "0"}, {"type": "i32", "value": "0"}]}, "expected": [{"type": "i32", "value": "0"}]}, {"type": "assert_trap", "line": 499, "action": {"type": "invoke", "field": "memory.atomic.notify", "args": [{"type": "i32", "value": "65536"}, {"type": "i32", "value": "0"}]}, "text": "out of bounds memory access", "expected": [{"type": "i32"}]}, {"type": "assert_trap", "line": 500, "action": {"type": "invoke", "field": "memory.atomic.notify", "args": [{"type": "i32", "value": "65531"}, {"type": "i32", "value": "0"}]}, "text": "unaligned atomic", "expected": [{"type": "i32"}]}, - {"type": "module", "line": 504, "filename": "atomic.3.wasm"}, - {"type": "module", "line": 557, "filename": "atomic.4.wasm"}, - {"type": "assert_return", "line": 561, "action": {"type": "invoke", "field": "fence", "args": []}, "expected": []}, - {"type": "assert_invalid", "line": 564, "filename": "atomic.5.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 565, "filename": "atomic.6.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 566, "filename": "atomic.7.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 567, "filename": "atomic.8.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 568, "filename": "atomic.9.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 569, "filename": "atomic.10.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 570, "filename": "atomic.11.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 571, "filename": "atomic.12.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 572, "filename": "atomic.13.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 573, "filename": "atomic.14.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 574, "filename": "atomic.15.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 575, "filename": "atomic.16.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 576, "filename": "atomic.17.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 577, "filename": "atomic.18.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 578, "filename": "atomic.19.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 579, "filename": "atomic.20.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 580, "filename": "atomic.21.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 581, "filename": "atomic.22.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 582, "filename": "atomic.23.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 583, "filename": "atomic.24.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 584, "filename": "atomic.25.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 585, "filename": "atomic.26.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 586, "filename": "atomic.27.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 587, "filename": "atomic.28.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 588, "filename": "atomic.29.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 589, "filename": "atomic.30.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 590, "filename": "atomic.31.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 591, "filename": "atomic.32.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 592, "filename": "atomic.33.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 593, "filename": "atomic.34.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 594, "filename": "atomic.35.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 595, "filename": "atomic.36.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 596, "filename": "atomic.37.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 597, "filename": "atomic.38.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 598, "filename": "atomic.39.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 599, "filename": "atomic.40.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 600, "filename": "atomic.41.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 601, "filename": "atomic.42.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 602, "filename": "atomic.43.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 603, "filename": "atomic.44.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 604, "filename": "atomic.45.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 605, "filename": "atomic.46.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 606, "filename": "atomic.47.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 607, "filename": "atomic.48.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 608, "filename": "atomic.49.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 609, "filename": "atomic.50.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 610, "filename": "atomic.51.wasm", "text": "unknown memory", "module_type": "binary"}, - {"type": "assert_invalid", "line": 611, "filename": "atomic.52.wasm", "text": "unknown memory", "module_type": "binary"}]} + {"type": "module", "line": 503, "filename": "atomic.3.wasm"}, + {"type": "module", "line": 556, "filename": "atomic.4.wasm"}, + {"type": "assert_return", "line": 560, "action": {"type": "invoke", "field": "fence", "args": []}, "expected": []}, + {"type": "assert_invalid", "line": 563, "filename": "atomic.5.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 564, "filename": "atomic.6.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 565, "filename": "atomic.7.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 566, "filename": "atomic.8.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 567, "filename": "atomic.9.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 568, "filename": "atomic.10.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 569, "filename": "atomic.11.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 570, "filename": "atomic.12.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 571, "filename": "atomic.13.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 572, "filename": "atomic.14.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 573, "filename": "atomic.15.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 574, "filename": "atomic.16.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 575, "filename": "atomic.17.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 576, "filename": "atomic.18.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 577, "filename": "atomic.19.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 578, "filename": "atomic.20.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 579, "filename": "atomic.21.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 580, "filename": "atomic.22.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 581, "filename": "atomic.23.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 582, "filename": "atomic.24.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 583, "filename": "atomic.25.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 584, "filename": "atomic.26.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 585, "filename": "atomic.27.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 586, "filename": "atomic.28.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 587, "filename": "atomic.29.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 588, "filename": "atomic.30.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 589, "filename": "atomic.31.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 590, "filename": "atomic.32.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 591, "filename": "atomic.33.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 592, "filename": "atomic.34.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 593, "filename": "atomic.35.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 594, "filename": "atomic.36.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 595, "filename": "atomic.37.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 596, "filename": "atomic.38.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 597, "filename": "atomic.39.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 598, "filename": "atomic.40.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 599, "filename": "atomic.41.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 600, "filename": "atomic.42.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 601, "filename": "atomic.43.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 602, "filename": "atomic.44.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 603, "filename": "atomic.45.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 604, "filename": "atomic.46.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 605, "filename": "atomic.47.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 606, "filename": "atomic.48.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 607, "filename": "atomic.49.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 608, "filename": "atomic.50.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 609, "filename": "atomic.51.wasm", "text": "unknown memory", "module_type": "binary"}, + {"type": "assert_invalid", "line": 610, "filename": "atomic.52.wasm", "text": "unknown memory", "module_type": "binary"}]} diff --git a/internal/integration_test/spectest/threads/testdata/atomic.wast b/internal/integration_test/spectest/threads/testdata/atomic.wast index 40259a9a..3ddbdc6a 100644 --- a/internal/integration_test/spectest/threads/testdata/atomic.wast +++ b/internal/integration_test/spectest/threads/testdata/atomic.wast @@ -499,7 +499,6 @@ (assert_trap (invoke "memory.atomic.notify" (i32.const 65536) (i32.const 0)) "out of bounds memory access") (assert_trap (invoke "memory.atomic.notify" (i32.const 65531) (i32.const 0)) "unaligned atomic") - ;; unshared memory is OK (module (memory 1 1)