Skip to content

Fix exact import in custom descriptors#2391

Merged
alexcrichton merged 2 commits intobytecodealliance:mainfrom
yurydelendik:cust-desc-exact
Nov 26, 2025
Merged

Fix exact import in custom descriptors#2391
alexcrichton merged 2 commits intobytecodealliance:mainfrom
yurydelendik:cust-desc-exact

Conversation

@yurydelendik
Copy link
Copy Markdown
Contributor

@yurydelendik yurydelendik commented Nov 25, 2025

Allows exact function imports such as:

 (import "" "" (func (exact (type $f))))
 (import "" "" (func (exact (type $f) (param) (result))))

The patch adds FuncExact to external kind and uses heap type reference (instead of index) in the entity function references field. I tried to match changes to the overview explanations in the Exact Function Imports sections.

I need help with:

  • component changes: is it make sense to have the similar change there too?
  • wasm-smith or wasm-mutate changes

Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit wary to match the spec exactly here in AST-representation where I would predict that idiomatically in Rust it'd be nicer to have Thing::{Func,FuncExact}(u32) as opposed to Thing::Func(ThingType { id: u32, exact: bool }). Did you try that already though and find that it was unworkable? If not, mind trying that out?

As for components/wasm-smith/wasm-encoder, where possible it's nice to keep things working but if major surgery or refactorings are required feel free to return an error and/or panic in those situations. I can take a look at any particular location in review and see if anything can't be semi-easily-handled or if it needs to do something else.

Comment thread crates/wasm-encoder/src/core/imports.rs Outdated
Comment thread crates/wasmparser/src/readers/core/imports.rs Outdated
@yurydelendik
Copy link
Copy Markdown
Contributor Author

in Rust it'd be nicer to have Thing::{Func,FuncExact}(u32) as opposed to Thing::Func(ThingType { id: u32, exact: bool }). Did you try that already though and find that it was unworkable? If not, mind trying that out?

Yep, I can try that.

Comment thread crates/wasm-encoder/src/reencode.rs Outdated
Comment thread crates/wasm-smith/src/core.rs
@alexcrichton
Copy link
Copy Markdown
Member

Nice that looks like it worked out well to me at least, with green CI should be good to go 👍

@yurydelendik yurydelendik force-pushed the cust-desc-exact branch 2 times, most recently from be0f680 to 1033764 Compare November 26, 2025 20:45
Copy link
Copy Markdown
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging by WebAssembly/testsuite#146 it looks like some instruction names may be getting an update too? (fine to land after this of course)

@yurydelendik yurydelendik marked this pull request as ready for review November 26, 2025 21:06
@yurydelendik yurydelendik requested a review from a team as a code owner November 26, 2025 21:06
@yurydelendik yurydelendik requested review from dicej and removed request for a team November 26, 2025 21:06
@yurydelendik
Copy link
Copy Markdown
Contributor Author

Judging by WebAssembly/testsuite#146 it looks like some instruction names may be getting an update too? (fine to land after this of course)

Yes, this is my next item. The newest update to the proposal will rollback some code around struct.new validation and adds struct.new_desc

@alexcrichton alexcrichton added this pull request to the merge queue Nov 26, 2025
Merged via the queue into bytecodealliance:main with commit adcfce7 Nov 26, 2025
34 checks passed
YDX-2147483647 added a commit to YDX-2147483647/typst-wasm-minimal-protocol that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants