Skip to content

Conversation

@yordis
Copy link
Contributor

@yordis yordis commented Oct 17, 2025

@alexcrichton
Copy link
Member

Thanks for this! Are you looking to get this merged ASAP? Or is this more of a proof-of-concept to support the development of the PR on the spec itself? If you're looking to get this merged sooner-rather-than-later, do you have plans to work on other parts of the stack such as wit-bindgen or Wasmtime?

@yordis
Copy link
Contributor Author

yordis commented Oct 20, 2025

@alexcrichton no rush at all in my end. I want to learn how to do the whole thing if possible if that is ok with you

@yordis yordis force-pushed the yordis/add-map-support branch 4 times, most recently from cd02439 to 2487714 Compare October 21, 2025 02:11
@yordis
Copy link
Contributor Author

yordis commented Oct 21, 2025

Note for self: 0x63 why is that typed in so many places instead of having a enum somewhere?

@yordis yordis marked this pull request as ready for review October 21, 2025 19:39
@yordis yordis requested a review from a team as a code owner October 21, 2025 19:39
@yordis yordis requested review from pchickey and removed request for a team October 21, 2025 19:39
@alexcrichton alexcrichton requested review from alexcrichton and removed request for pchickey October 21, 2025 21:51
Copy link
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.

Ok looked over things, and thanks for this!

In terms of implementing this, adding a new type is a relatively major endeavor that takes awhile as there are a lot of integration points. Given that we'll want to make sure that this work is properly "gated" from external users to avoid, in theory, accidentally hitting unimplemented parts of the type system. The primary way this is done is via WasmFeatures in the wasmparser crate. What I'd recommend is adding a new cm_map feature similar to cm_fixed_size_lists. Effectively you'll want to add a bunch of tests/checks/etc in the same manner as fixed-size-lists, also an unstable feature at this time.

Additionally you'll want to add tests in tests/cli/component-model/*.wast for this new type as well. You should be able to find tests for fixed-size-lists around there and you can structure tests in a similar way.

Other than that though I think this would be reasonable to land. After landing here would come integration work into wasmtime/wit-bindgen/etc.

@yordis yordis requested a review from alexcrichton November 21, 2025 19:56
Copy link
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.

Looking good, thanks! The remaining things I can think of are:

  • This needs a new feature gate in wasmparser's validation to ensure that this isn't accidentally usable-by-default.
  • This needs *.wast tests for the component-model side of things to ensure that the type works in the text format, validation, etc. There should also be tests ensuring that if the feature gate is disabled that usage of the type is an error (you can copy fixed-size-list tests for example)
  • Tests are currently not passing in CI, so that'll need to be green

@yordis yordis force-pushed the yordis/add-map-support branch 2 times, most recently from 1e65742 to 2ea4fec Compare December 3, 2025 21:11
@yordis yordis force-pushed the yordis/add-map-support branch from 2ea4fec to f1a8786 Compare December 15, 2025 00:32
@yordis yordis requested a review from alexcrichton December 15, 2025 08:36
@alexcrichton
Copy link
Member

@yordis it looks like the feature gating still isn't implemented?

@yordis
Copy link
Contributor Author

yordis commented Dec 19, 2025

@alexcrichton 🤦🏻 sorry ... I completely forgot focusing on making CI to pass again resolving the comments ... let me work on that

@yordis
Copy link
Contributor Author

yordis commented Dec 19, 2025

cargo fmt
Error writing files: failed to resolve mod bindings: /Users/yordisstudio/Developer/github.com/bytecodealliance/wasm-tools/playground/component/src/bindings.rs does not exist

@alexcrichton when I ran cargo fmt it seems that there is a missing file here, what is reason for that file to be missing from the code base? Or rather, at the very least be added to a .gitignore so I can keep a dummy file to make the formatter to work

@yordis yordis force-pushed the yordis/add-map-support branch 2 times, most recently from 8698f34 to 51b1558 Compare December 19, 2025 18:48
@alexcrichton
Copy link
Member

Sorry I'm not sure what you're referring to? If you run find . -name '*.rs' | xargs rustfmt --check --edition 2021 like CI does, does that fix things? (no CI is currently being run due to a merge conflict)

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis yordis force-pushed the yordis/add-map-support branch from f70170f to 4f3e386 Compare December 19, 2025 23:07
@yordis
Copy link
Contributor Author

yordis commented Dec 19, 2025

Sorry I'm not sure what you're referring to? If you run find . -name '*.rs' | xargs rustfmt --check --edition 2021 like CI does, does that fix things?

Yeah, just wondering why the cargo fmt by itself wouldn't work here, no biggy

Copy link
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.

Thanks!

///
/// Corresponds to the 🗺️ character in
/// <https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md>.
pub cm_map: CM_MAP(1 << 37) = false;
Copy link
Member

Choose a reason for hiding this comment

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

I think the 37 here conflicts with compact_imports below now. I think it's reasonable to leave this adjacent to cm_gc, but feel free to renumber the below bits to ensure the biggest number is last

Copy link
Contributor Author

@yordis yordis Dec 22, 2025

Choose a reason for hiding this comment

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

It scares me that my tests passed 😭 I do not like things no breaking with these type of changes.

Could this use a enum thou?

///
/// Corresponds to the 🗺️ character in
/// <https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md>.
pub cm_map: CM_MAP(1 << 38) = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I rather keep it based on the flag value than grouping things ... I think that caused the issue to begin with

@alexcrichton alexcrichton added this pull request to the merge queue Dec 22, 2025
Merged via the queue into bytecodealliance:main with commit 165430b Dec 22, 2025
34 checks passed
@yordis yordis deleted the yordis/add-map-support branch December 22, 2025 19:09
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