Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wasm threads proposal tests and fix cmpxchg_u #19200

Conversation

justinmichaud
Copy link
Contributor

@justinmichaud justinmichaud commented Oct 18, 2023

6b5f203

Update wasm threads proposal tests and fix cmpxchg_u
https://bugs.webkit.org/show_bug.cgi?id=263292
rdar://117102231

Reviewed by NOBODY (OOPS!).

In WebAssembly/threads#195, it was documented
that JSC implements cmpxchg_u without wrapping the expected value.

Previously, the spec tests and reference interpreter followed this interpretation,
but the spec text, SpiderMonkey and v8 did the wrapping.

The spec tests were updated, and this new behaviour is simpler anyway,
so let's just do it.

* JSTests/wasm/spec-tests/atomic.wast.js: Added.
* JSTests/wasm/spec-tests/binary-leb128.wast.js:
* JSTests/wasm/spec-tests/binary.wast.js:
* JSTests/wasm/spec-tests/br_table.wast.js:
* JSTests/wasm/spec-tests/elem.wast.js:
* JSTests/wasm/spec-tests/float_literals.wast.js:
* JSTests/wasm/threads-spec-tests/atomic-signed.wast.js:
* Source/JavaScriptCore/llint/WebAssembly64.asm:
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::emitAtomicCompareExchange):
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJIT::emitAtomicCompareExchange):

6b5f203

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🧪 gtk-wk2
✅ 🛠 🧪 jsc ❌ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 api-gtk
❌ 🛠 🧪 jsc-arm64 ✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ❌ 🧪 jsc-armv7-tests
✅ 🛠 watch ✅ 🛠 jsc-mips
✅ 🛠 watch-sim loading 🧪 jsc-mips-tests

https://bugs.webkit.org/show_bug.cgi?id=263292
rdar://117102231

Reviewed by NOBODY (OOPS!).

In WebAssembly/threads#195, it was documented
that JSC implements cmpxchg_u without wrapping the expected value.

Previously, the spec tests and reference interpreter followed this interpretation,
but the spec text, SpiderMonkey and v8 did the wrapping.

The spec tests were updated, and this new behaviour is simpler anyway,
so let's just do it.

* JSTests/wasm/spec-tests/atomic.wast.js: Added.
* JSTests/wasm/spec-tests/binary-leb128.wast.js:
* JSTests/wasm/spec-tests/binary.wast.js:
* JSTests/wasm/spec-tests/br_table.wast.js:
* JSTests/wasm/spec-tests/elem.wast.js:
* JSTests/wasm/spec-tests/float_literals.wast.js:
* JSTests/wasm/threads-spec-tests/atomic-signed.wast.js:
* Source/JavaScriptCore/llint/WebAssembly64.asm:
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::emitAtomicCompareExchange):
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJIT::emitAtomicCompareExchange):
@justinmichaud justinmichaud requested a review from a team as a code owner October 18, 2023 00:12
@justinmichaud justinmichaud self-assigned this Oct 18, 2023
@justinmichaud justinmichaud added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Oct 18, 2023
// elem.wast:688
register("module4", $module4)

// elem.wast:690
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to figure out why we fail this

@@ -671,7 +671,7 @@ run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x89\x80\x80\x80\x0
run(() => call(instance("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x88\x80\x80\x80\x00\x02\x60\x00\x00\x60\x01\x7e\x00\x02\x8b\x80\x80\x80\x00\x01\x02\x24\x31\x04\x69\x6e\x69\x74\x00\x01\x03\x82\x80\x80\x80\x00\x01\x00\x07\x87\x80\x80\x80\x00\x01\x03\x72\x75\x6e\x00\x01\x0a\x99\x80\x80\x80\x00\x01\x93\x80\x80\x80\x00\x00\x02\x40\x42\xf0\xe1\xc3\x87\x8f\x9e\xbc\xf8\x70\x10\x00\x0f\x0b\x00\x0b", exports("$1", $1)), "run", [])); // run(() => call($1, "init", [int64("-1_085_102_592_571_150_096")]))

// atomic-signed.wast:402
assert_return(() => call($1, "i32.atomic.rmw8.cmpxchg_u", [0, -252_645_136, 17]), 240);
// assert_return(() => call($1, "i32.atomic.rmw8.cmpxchg_u", [0, -252_645_136, 17]), 240);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is no longer included upstream, so I just commented out the bad tests

Copy link
Member

@Constellation Constellation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

Copy link
Contributor

@kmiller68 kmiller68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we update the IPInt while we're at it? Note, there's no testing in automation for IPInt so you'll have to run the spec tests by hand with --useWasmIPInt=1

@justinmichaud justinmichaud deleted the eng/Update-wasm-threads-proposal-tests-and-fix-cmpxchg_u branch November 26, 2023 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants