Add i64 to the set of JS-compatible wasm types in syncWebAssembly mode#16339
Merged
Conversation
… mode For quite a while now, it's been possible for WebAssembly `i64`s to be converted to/from JS bigints (as function parameters, results, etc.). However, `syncWebAssembly` mode currently rejects any modules that attempt to do so, because `i64` isn't in it's list of JS-compatible types. This fixes that by adding `i64` to that list. There was an existing test that used `i64` as an example of a non-JS-compatible type; I replaced that with `v128`.
|
|
Contributor
|
For maintainers only:
|
Contributor
Author
|
The CI failure looks to be unrelated to my changes. |
sokra
approved these changes
Nov 9, 2022
Member
|
Thanks |
Given that there hasn't been a v4 release in almost two years, is it safe to assume this won't be backported? |
jcbhl
added a commit
to jcbhl/puzzle-solver
that referenced
this pull request
Jul 27, 2023
Running into challenges. The Rust part compiles, but when building with Webpack, I get this error: ``` ERROR in ./pkg/index_bg.wasm Import "__wbindgen_bigint_from_u64" from "./index_bg.js" with Non-JS-compatible Func Sigurature (i64 as parameter) can only be used for direct wasm to wasm dependencies @ ./pkg/index.js @ ./js/index.js ℹ 「wdm」: Failed to compile. ``` This issue (wasm-bindgen/wasm-bindgen#3095) talks about the same problem. The fix (webpack/webpack#16339) was merged but not backported into Webpack 4, so I'm going to have to try and upgrade to fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For quite a while now, it's been possible for WebAssembly
i64s to be converted to/from JS bigints (as function parameters, results, etc.). However,syncWebAssemblymode currently rejects any modules that attempt to do so, becausei64isn't in it's list of JS-compatible types. This fixes that by addingi64to that list.Fixes #8531, although that was already closed from inactivity.
(Note: this fix is mainly meant for being backported to webpack 4, since
syncWebAssemblyis deprecated anyway, but I've implemented it against webpack 5 first.)This caused wasm-bindgen/wasm-bindgen#3095 when
wasm-bindgenswitched to directly pass 64-bit integers asi64s rather than as a pair ofi32s; that issue is mostly about webpack 4, though, so this'll need to be backported before that's fixed.There was an existing test that used
i64as an example of a non-JS-compatible type; I replaced that withv128.