-
Notifications
You must be signed in to change notification settings - Fork 824
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
Fix returning negative i64 values on web target #3796
Fix returning negative i64 values on web target #3796
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests verifying that the issue is fixed?
Yes, I wanted to do that, but I do know where to begin. I am looking into the The closest file I could find is |
3adb439
to
fe3d307
Compare
Ok, I have tried adding this test. It is loading the WASM plugin from a The plugin exports a function that adds one, then calls the imported "add one" function and then adds one again to add three in total. This tests back and forth exchanging of values between the plugin and the host. Same idea as I did with fp-bindgen. I am testing it with interesting values that might overflow (near I have verified that this test fails on the current But what I am missing is a way to run this automatically. It seems that node can run WASM, but I will have to try that. |
Cool, feel free to add the test inside You can also that the test is working by running |
308ef91
to
6f0ea57
Compare
Ok, I have tried that, but I cannot get it to work. There seems to be some problem with
After doing some searching, I have found this article about bigint support in node, but I have not figures out how to pass the |
Tests passed in CI so I suspect that you may have an old version of Node installed in your system @kajacx |
I am ill right now, so I will not be doing anything on the computer for a few weeks. You can merge the PR if it looks good, I will re-check it to my satisfaction later either way. |
@syrusakbary it seems ready to be merged? |
Yup, good to merge! |
Description
Fixes #3773, which is a bug where returning a negative
i64
from a module caused a crash when wasmer itself was running inside the browser using thejs
feature.Looking at
js-sys
's implementation ofTryFrom
, it looks likeBigInt
is converted toJsValue
anyway before converting it further, so convertingBigInt
toJsValue
just so it is converted back seems like extra work.To be honest, this needs an automated test, but I don't really know to make one. Can node load wasmer with the
js
feature? That is worth looking into.