From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../etc/wasm/generate-spectests/Cargo.lock | 15 +- .../etc/wasm/generate-spectests/config.toml | 18 +-- .../etc/wasm/generate-spectests/wast2js/Cargo.toml | 2 +- js/src/jit-test/etc/wasm/spec-tests.patch | 154 ++++++++++++++++++++- 4 files changed, 175 insertions(+), 14 deletions(-) (limited to 'js/src/jit-test/etc') diff --git a/js/src/jit-test/etc/wasm/generate-spectests/Cargo.lock b/js/src/jit-test/etc/wasm/generate-spectests/Cargo.lock index 129b13b7f6..756fc8e6ac 100644 --- a/js/src/jit-test/etc/wasm/generate-spectests/Cargo.lock +++ b/js/src/jit-test/etc/wasm/generate-spectests/Cargo.lock @@ -28,6 +28,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "bumpalo" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" + [[package]] name = "cfg-if" version = "1.0.0" @@ -193,7 +199,9 @@ checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" [[package]] name = "wasm-encoder" -version = "0.38.1" +version = "0.41.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "972f97a5d8318f908dded23594188a90bcd09365986b1163e66d70170e5287ae" dependencies = [ "leb128", ] @@ -214,8 +222,11 @@ dependencies = [ [[package]] name = "wast" -version = "69.0.1" +version = "71.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "647c3ac4354da32688537e8fc4d2fe6c578df51896298cb64727d98088a1fd26" dependencies = [ + "bumpalo", "leb128", "memchr", "unicode-width", diff --git a/js/src/jit-test/etc/wasm/generate-spectests/config.toml b/js/src/jit-test/etc/wasm/generate-spectests/config.toml index 48e5be6e0d..d058a79986 100644 --- a/js/src/jit-test/etc/wasm/generate-spectests/config.toml +++ b/js/src/jit-test/etc/wasm/generate-spectests/config.toml @@ -1,6 +1,6 @@ # Standard 'directives.txt' prologues for jit-tests harness_directive = "|jit-test| skip-if: true" -directive = "|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js" +directive = "|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--setpref=wasm_test_serialization=true; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js" # Failing tests across all testsuites excluded_tests = [ @@ -43,7 +43,7 @@ url = "https://github.com/WebAssembly/exception-handling" branch = "main" parent = "spec" # Skip in jit-test when it's not enabled -directive = "; --wasm-exceptions; --wasm-exnref; skip-if: !wasmExceptionsEnabled()" +directive = "; --setpref=wasm_exnref=true; skip-if: !wasmExnRefEnabled()" excluded_tests = [ # harness doesn't support exnref, because JS-API globals can't use it "ref_null.wast.js" @@ -53,7 +53,7 @@ excluded_tests = [ name = "memory64" url = "https://github.com/mozilla-spidermonkey/memory64" branch = "test-cases" -directive = "; skip-if: !wasmMemory64Enabled()" +directive = "; --setpref=wasm_memory64=true; skip-if: !wasmMemory64Enabled()" excluded_tests = [] [[repos]] @@ -61,7 +61,7 @@ name = "function-references" url = "https://github.com/WebAssembly/function-references" branch = "main" parent = "spec" -directive = "; --wasm-function-references; skip-if: !wasmFunctionReferencesEnabled()" +directive = "; --setpref=wasm_gc=true; skip-if: !wasmGcEnabled()" excluded_tests = [ # duplicate tail calls tests "return_call.wast", @@ -87,7 +87,7 @@ name = "relaxed-simd" url = "https://github.com/WebAssembly/relaxed-simd" branch = "main" parent = "spec" -directive = "; --wasm-relaxed-simd; skip-if: !wasmRelaxedSimdEnabled()" +directive = "; --setpref=wasm_relaxed_simd=true; skip-if: !wasmRelaxedSimdEnabled()" excluded_tests = [] [[repos]] @@ -95,7 +95,7 @@ name = "extended-const" url = "https://github.com/WebAssembly/extended-const" branch = "main" parent = "spec" -directive = "; --wasm-extended-const; --no-wasm-gc; skip-if: !wasmExtendedConstEnabled()" +directive = "; --setpref=wasm_gc=false" excluded_tests = [] [[repos]] @@ -103,7 +103,7 @@ name = "tail-call" url = "https://github.com/WebAssembly/tail-call" branch = "main" parent = "spec" -directive = "; --wasm-tail-calls; skip-if: !wasmTailCallsEnabled()" +directive = "; --setpref=wasm_tail_calls=true; skip-if: !wasmTailCallsEnabled()" excluded_tests = [] [[repos]] @@ -111,7 +111,7 @@ name = "multi-memory" url = "https://github.com/WebAssembly/multi-memory" branch = "main" parent = "spec" -directive = "; --wasm-multi-memory; skip-if: !wasmMultiMemoryEnabled()" +directive = "; --setpref=wasm_multi_memory=true; skip-if: !wasmMultiMemoryEnabled()" excluded_tests = [ # Empty test fails parsing "memory_copy1.wast", @@ -122,7 +122,7 @@ name = "gc" url = "https://github.com/WebAssembly/gc" branch = "main" parent = "function-references" -directive = "; --wasm-gc; skip-if: !wasmGcEnabled()" +directive = "; --setpref=wasm_gc=true; skip-if: !wasmGcEnabled()" excluded_tests = [ # tail call tests that snuck in "return_call.wast", diff --git a/js/src/jit-test/etc/wasm/generate-spectests/wast2js/Cargo.toml b/js/src/jit-test/etc/wasm/generate-spectests/wast2js/Cargo.toml index b55ae458df..1c7c3174e9 100644 --- a/js/src/jit-test/etc/wasm/generate-spectests/wast2js/Cargo.toml +++ b/js/src/jit-test/etc/wasm/generate-spectests/wast2js/Cargo.toml @@ -8,4 +8,4 @@ edition = "2018" [dependencies] anyhow = "1.0.19" -wast = { path = "../../../../../../../../wasm-tools/crates/wast" } +wast = "71.0.1" diff --git a/js/src/jit-test/etc/wasm/spec-tests.patch b/js/src/jit-test/etc/wasm/spec-tests.patch index a3c0e15676..cdd0d1aebc 100644 --- a/js/src/jit-test/etc/wasm/spec-tests.patch +++ b/js/src/jit-test/etc/wasm/spec-tests.patch @@ -78,6 +78,40 @@ diff --git a/js/src/jit-test/tests/wasm/spec/memory64/memory_trap64.wast.js b/js + value("i64", 7523094288207667809n), + ]); +} +diff --git a/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js b/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js +--- a/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js ++++ b/js/src/jit-test/tests/wasm/spec/memory64/memory64.wast.js +@@ -27,17 +27,19 @@ let $2 = instantiate(`(module (memory i64 1 256))`); + // ./test/core/memory64.wast:6 + let $3 = instantiate(`(module (memory i64 0 65536))`); + +-// ./test/core/memory64.wast:8 +-assert_invalid( +- () => instantiate(`(module (memory i64 0) (memory i64 0))`), +- `multiple memories`, +-); +- +-// ./test/core/memory64.wast:9 +-assert_invalid( +- () => instantiate(`(module (memory (import "spectest" "memory") i64 0) (memory i64 0))`), +- `multiple memories`, +-); ++if (!wasmMultiMemoryEnabled()) { ++ // ./test/core/memory64.wast:8 ++ assert_invalid( ++ () => instantiate(`(module (memory i64 0) (memory i64 0))`), ++ `multiple memories`, ++ ); ++ ++ // ./test/core/memory64.wast:9 ++ assert_invalid( ++ () => instantiate(`(module (memory (import "spectest" "memory") i64 0) (memory i64 0))`), ++ `multiple memories`, ++ ); ++} + + // ./test/core/memory64.wast:11 + let $4 = instantiate(`(module (memory i64 (data)) (func (export "memsize") (result i64) (memory.size)))`); diff --git a/js/src/jit-test/tests/wasm/spec/multi-memory/simd_load.wast.js b/js/src/jit-test/tests/wasm/spec/multi-memory/simd_load.wast.js --- a/js/src/jit-test/tests/wasm/spec/multi-memory/simd_load.wast.js +++ b/js/src/jit-test/tests/wasm/spec/multi-memory/simd_load.wast.js @@ -105,6 +139,94 @@ diff --git a/js/src/jit-test/tests/wasm/spec/multi-memory/simd_store.wast.js b/j /* Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); +diff --git a/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js b/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js +--- a/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js ++++ b/js/src/jit-test/tests/wasm/spec/multi-memory/harness/harness.js +@@ -19,6 +19,15 @@ if (!wasmIsSupported()) { + quit(); + } + ++function partialOobWriteMayWritePartialData() { ++ let arm_native = getBuildConfiguration("arm") && !getBuildConfiguration("arm-simulator"); ++ let arm64_native = getBuildConfiguration("arm64") && !getBuildConfiguration("arm64-simulator"); ++ return arm_native || arm64_native; ++} ++ ++let native_arm = getBuildConfiguration("arm") && !getBuildConfiguration("arm-simulator"); ++let native_arm64 = getBuildConfiguration("arm64") && !getBuildConfiguration("arm64-simulator"); ++ + function bytes(type, bytes) { + var typedBuffer = new Uint8Array(bytes); + return wasmGlobalFromArrayBuffer(type, typedBuffer.buffer); +diff --git a/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js b/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js +--- a/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js ++++ b/js/src/jit-test/tests/wasm/spec/multi-memory/memory_trap1.wast.js +@@ -562,11 +562,15 @@ assert_trap(() => invoke($0, `i64.load32_u`, [-3]), `out of bounds memory access + // ./test/core/multi-memory/memory_trap1.wast:234 + assert_trap(() => invoke($0, `i64.load32_u`, [-4]), `out of bounds memory access`); + +-// ./test/core/multi-memory/memory_trap1.wast:237 +-assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 7523094288207667809n)]); ++// Bug 1842293 - do not observe the partial store caused by bug 1666747 on ++// some native platforms. ++if (!partialOobWriteMayWritePartialData()) { ++ // ./test/core/multi-memory/memory_trap1.wast:237 ++ assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 7523094288207667809n)]); + +-// ./test/core/multi-memory/memory_trap1.wast:238 +-assert_return(() => invoke($0, `i64.load`, [0]), [value("i64", 7523094288207667809n)]); ++ // ./test/core/multi-memory/memory_trap1.wast:238 ++ assert_return(() => invoke($0, `i64.load`, [0]), [value("i64", 7523094288207667809n)]); ++} + + // ./test/core/multi-memory/memory_trap1.wast:242 + assert_return(() => invoke($0, `i64.store`, [65528, 0n]), []); +@@ -574,14 +578,18 @@ assert_return(() => invoke($0, `i64.store`, [65528, 0n]), []); + // ./test/core/multi-memory/memory_trap1.wast:243 + assert_trap(() => invoke($0, `i32.store`, [65533, 305419896]), `out of bounds memory access`); + +-// ./test/core/multi-memory/memory_trap1.wast:244 +-assert_return(() => invoke($0, `i32.load`, [65532]), [value("i32", 0)]); ++if (!partialOobWriteMayWritePartialData()) { ++ // ./test/core/multi-memory/memory_trap1.wast:244 ++ assert_return(() => invoke($0, `i32.load`, [65532]), [value("i32", 0)]); ++} + + // ./test/core/multi-memory/memory_trap1.wast:245 + assert_trap(() => invoke($0, `i64.store`, [65529, 1311768467294899695n]), `out of bounds memory access`); + +-// ./test/core/multi-memory/memory_trap1.wast:246 +-assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 0n)]); ++if (!partialOobWriteMayWritePartialData()) { ++ // ./test/core/multi-memory/memory_trap1.wast:246 ++ assert_return(() => invoke($0, `i64.load`, [65528]), [value("i64", 0n)]); ++} + + // ./test/core/multi-memory/memory_trap1.wast:247 + assert_trap( +@@ -589,8 +597,10 @@ assert_trap( + `out of bounds memory access`, + ); + +-// ./test/core/multi-memory/memory_trap1.wast:248 +-assert_return(() => invoke($0, `f32.load`, [65532]), [value("f32", 0)]); ++if (!partialOobWriteMayWritePartialData()) { ++ // ./test/core/multi-memory/memory_trap1.wast:248 ++ assert_return(() => invoke($0, `f32.load`, [65532]), [value("f32", 0)]); ++} + + // ./test/core/multi-memory/memory_trap1.wast:249 + assert_trap( +@@ -598,5 +608,7 @@ assert_trap( + `out of bounds memory access`, + ); + +-// ./test/core/multi-memory/memory_trap1.wast:250 +-assert_return(() => invoke($0, `f64.load`, [65528]), [value("f64", 0)]); ++if (!partialOobWriteMayWritePartialData()) { ++ // ./test/core/multi-memory/memory_trap1.wast:250 ++ assert_return(() => invoke($0, `f64.load`, [65528]), [value("f64", 0)]); ++} diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js --- a/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js +++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js @@ -132,6 +254,34 @@ diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wa ), ], ); +diff --git a/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js b/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js +--- a/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js ++++ b/js/src/jit-test/tests/wasm/spec/spec/memory.wast.js +@@ -33,14 +33,16 @@ let $4 = instantiate(`(module (memory 1 256))`); + // ./test/core/memory.wast:8 + let $5 = instantiate(`(module (memory 0 65536))`); + +-// ./test/core/memory.wast:10 +-assert_invalid(() => instantiate(`(module (memory 0) (memory 0))`), `multiple memories`); +- +-// ./test/core/memory.wast:11 +-assert_invalid( +- () => instantiate(`(module (memory (import "spectest" "memory") 0) (memory 0))`), +- `multiple memories`, +-); ++if (!wasmMultiMemoryEnabled()) { ++ // ./test/core/memory.wast:10 ++ assert_invalid(() => instantiate(`(module (memory 0) (memory 0))`), `multiple memories`); ++ ++ // ./test/core/memory.wast:11 ++ assert_invalid( ++ () => instantiate(`(module (memory (import "spectest" "memory") 0) (memory 0))`), ++ `multiple memories`, ++ ); ++} + + // ./test/core/memory.wast:13 + let $6 = instantiate(`(module (memory (data)) (func (export "memsize") (result i32) (memory.size)))`); diff --git a/js/src/jit-test/tests/wasm/spec/spec/simd_address.wast.js b/js/src/jit-test/tests/wasm/spec/spec/simd_address.wast.js --- a/js/src/jit-test/tests/wasm/spec/spec/simd_address.wast.js +++ b/js/src/jit-test/tests/wasm/spec/spec/simd_address.wast.js @@ -632,7 +782,7 @@ index 3ea51a8cb0ff3..71739f4a1c8e4 100644 --- a/js/src/jit-test/tests/wasm/spec/function-references/return_call_ref.wast.js +++ b/js/src/jit-test/tests/wasm/spec/function-references/return_call_ref.wast.js @@ -1,3 +1,4 @@ -+// |jit-test| --wasm-tail-calls; skip-if: !wasmTailCallsEnabled() ++// |jit-test| --setpref=wasm_tail_calls=true; skip-if: !wasmTailCallsEnabled() /* Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -640,7 +790,7 @@ diff --git a/js/src/jit-test/tests/wasm/spec/spec/global.wast.js b/js/src/jit-te --- a/js/src/jit-test/tests/wasm/spec/spec/global.wast.js +++ b/js/src/jit-test/tests/wasm/spec/spec/global.wast.js @@ -1,3 +1,4 @@ -+// |jit-test| --no-wasm-gc ++// |jit-test| --setpref=wasm_gc=false /* Copyright 2021 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); -- cgit v1.2.3