-
-
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
Rewrite wasm-bindgen with updated interface types proposal #1882
Rewrite wasm-bindgen with updated interface types proposal #1882
Conversation
Next up figuring out how to juggle malloc functions for strings and vectors and such.
On to actually running the test suite!
Note that this change isn't quite ready to land yet, but I wanted to start getting some CI feedback to see how this fares. Additionally I would like to greatly expand the test coverage of the anyref pass, multivalue pass, and support for interface types. I plan on doing all that before landing this. |
Get some examples of what the transform looks like in `*.wat` files
Basically the same as the anyref tests, but tailored for the multivalue transform instead.
(func $dealloc (export "__wbindgen_anyref_table_dealloc") (param i32)) | ||
) | ||
|
||
(; CHECK-ALL: |
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.
Nice. Maybe worth pulling our simple filecheck implementation into a reusable crate?
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.
I've been tweaking this as I've gone along for various crates, but it's starting to reach a steady state, yeah, so we should probably look into extracting it soon!
// which calls an imported function. | ||
// | ||
// FIXME(#1872) handle this | ||
// if let Some(Instruction::StoreRetptr { .. }) = instructions.last() {} |
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.
Is this something we need to handle before merging?
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.
Nah this was never exercised or supported before, so I don't think we need to handle this. Once we start writing more wasm-interface-types tests, though, I think we'll want to fill this out pretty shortly afterwards.
(func $foo (export "foo") (param i32)) | ||
) | ||
|
||
(; CHECK-ALL: |
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.
Thanks for adding this 👍
This commit removes all the magical names flying around in the JS generation for managing anyref items and anyref tables. Instead IDs are set during the anyref pass and these are propagated to the end. This also deletes references to GC'ing code in the anyref module now that they've been verified to no longer be needed.
Leave a comment though indicating how it should be reenabled if anyone hits the error.
Also remove dead code for translating incoming slices since they're not supported yet in the trait implementations anyway.
Re-enable it for all imported functions, and then selectively disable it once an intrinsic is called.
Ok thanks for the review @fitzgen! I think I've taken care of everything now, so I'm going to merge this and incrementally improve support for wasm interface types in subsequent PRs, hopefully as a bit more digestable. |
Accidentally left out of rustwasm#1882
Accidentally left out of #1882
This commit is a pretty large scale rewrite of the internals of wasm-bindgen. No user-facing changes are expected as a result of this PR, but due to the scale of changes here it's likely inevitable that at least something will break. I'm hoping to get more testing in though before landing!
The purpose of this PR is to update wasm-bindgen to the current state of the interface types proposal. The wasm-bindgen tool was last updated when it was still called "WebIDL bindings" so it's been awhile! All support is now based on https://github.com/bytecodealliance/wasm-interface-types which defines parsers/binary format/writers/etc for wasm-interface types.
This is a pretty massive PR and unfortunately can't really be split up any more afaik. I don't really expect realistic review of all the code here (or commits), but some high-level changes are:
TODO:
Follow-up work