-
Notifications
You must be signed in to change notification settings - Fork 770
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
wasm2js output from AssemblyScript input hangs #7245
Comments
To debug this, I would add some logging in the source, to see where the wasm2js build starts to behave differently. If you can't figure it out that way, adding lower-level logging using binaryen is an option, like If you want, attach the wasm file here for us to investigate. |
Looks like the code hangs somewhere in
|
I think I figured out the issue in the source AssemblyScript code I included this part in the algorithm specifically for AssemblyScript because AssemblyScript is representing integers as decimals
That is, when I replace that part with
and run with
However, if I use that input WASM to
|
I don't see the wasm file in the archive? With the wasm file and a way to run it I could compare wasm to wasm2js. |
Thought I included the WASM... I've updated the AssemblyScript code (see AssemblyScript/assemblyscript#2901 (comment)) to fix the part I initially filed this issue for, though the I'm including the AssemblyScrip code, the WASM compiled using
The
With
With
See that |
I get this error with node 20:
|
That's Node.js clinging on to CommonJS. I'm running |
https://nodejs.org/en/blog/release/v20.10.0
|
Interestingly that bug in the output by
And here the 10th and 11th indexes are mangled together
Bun can run WASM out of the box. Here's running the source WASM that
Here's Rust compiled to WASM version of the same algorithm
However, push it to
|
I'm thinking there might be an issue with the algorithm I'm using, around here since the error message is printing division by zero
|
I think we've gotten past the hanging part. I'll figure out how to improve the algorithm in the source code. Thanks. |
Just for comparison AssemblyScript source code compiled to JavaScript using TypeScript
|
I think the 13 and greater factorial then error could be AssemblyScript related. Here's the same algorithm using Bytecode Alliance Javy
Facebook's Static Hermes compiled to WASM with WASI-SDK
|
This is not exclusive to AssemblyScript input. Rust to WASM to JavaScript produces the same result
The 10th index of stringified output array is still mangled at
|
@kripken I figured it out. I write each
Thanks, again. |
I compiled AssemblyScript to WASM, then compiled WASM to JavaScript with
wasm2js
. The WASM works as expected withwasmtime
. The resulting JavaScript hangs when running withnode
,deno
, andbun
.I've done the same process described above with Rust source code, Bytecode Alliance's Javy, and Facebook's Static Hermes; that is, source code to WASM, WASM to JavaScript using
wasm2js
, then running that JavaScript with WASI support with a JavaScript runtime.This is the first time I have encountered code output by
wasm2js
hanging. I don't know if the issue is AssemblyScript source,wasm2js
output, or the WASI (preview1) implementation I'm using.The code
module.ts
or
At the bottom of the JavaScript output by
wasm2js
This just hangs until
^C
The text was updated successfully, but these errors were encountered: