-
Notifications
You must be signed in to change notification settings - Fork 257
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
Use of i64 in the syscall layer is problematic for JS embedders #54
Comments
Splitting And it will be difficult to change the WASI interface to avoid 64 bit values, if only to represent file offsets. |
v8 (chrome) has --experimental-wasm-bigint. I think it's reasonable to keep the i64 interfaces. |
I would suggest doing both: exporting i64 and an i32/i32 equivalent. In the runtime you can call the i64 version and if it throws fallback to the lowered version. This is reliable because the spec only throws on a call from JS. |
The difference is that in emscripten all the i64 are removed from the imports and exports by binaryen, so the final wasm doesn't have any i64s at the boundary. This means dealing with a WASI module is a lot harder than an emscripten one. With the WASI module there no way to satisfy the imports using JS functions. |
This all sounds like a reason to prioritize implementation of the BigInt/i64 integration proposal, rather than going around the issue forever. |
Good point, |
it's not blocking it from landing as it's all flagged experimental, but this would block it from being unflagged. |
Closing out since I don't think we want to fix this, but instead push for BigInt/i64 integration. |
32-bit support for BigInt/i64 integration has just landed in v8. |
Even with BitInt in many engines, chrome at least still doesn't support the use of BitInt for i64 WebAssembly bindings.
I know WASI is forward looking so this was most likely a deliberate design choice, but I thought at least mention it here for the record and see what solutions others have come up with.
To fully implement the current unstable syscalls in a JS engine today it seems to me that one would need to create a shim WASM file that split all the i64 values into a pair of i32 and route the problematic syscalls through this layer to JS.
Has anyone else found any other way to do this?
The text was updated successfully, but these errors were encountered: