-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 a number of anyref
related bugs in our passes
#1692
Conversation
This functionality got lost in recent refactorings for WebIDL bindings unfortunately, so this commit touches things up to ensure that the anyref table initialization in anyref-mode is hooked up correctly, even when tests are enabled. This invovled moving injection of the start function to the webidl processing pass and ensuring its intrinsic is registered in the internal maps of wasm-bindgen.
With more than two anyref stack arguments we were accidentally storing the anyref values one higher in the stack than intended, so fix this off-by-one by switching up some addition logic.
This is currently required by our ABI for wasm-bindgen where `None` js values going out have an index of 0 and are intended to be `undefined`. This also refactors initialization a bit to be slightly more generic over the constants we already have defined in this module.
This `base` value is the raw value coming out of the first call to `table.grow`. Throwing in the addition of `JSIDX_RESERVED` just wasn't right!
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.
Very nice 👏
@@ -145,7 +145,7 @@ intrinsics! { | |||
#[symbol = "__wbindgen_anyref_heap_live_count"] | |||
#[signature = fn() -> I32] | |||
AnyrefHeapLiveCount, | |||
#[symbol = "__wbindgen_init_nyref_table"] |
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.
lolsob...
So now that node has proper |
Soon we can I think! The support just (like 24 hours ago) landed on the master branch of nodejs, so I think we'll need to wait for the next release and then we should be able to download a recent verison of Node to test with. |
This commit goes through and fixes a number of bugs around the
anyref
pass inwasm-bindgen
. Most of the issues were around initialization and tests, but after this commit the full test suite passes in Node.js. Yay!