-
Notifications
You must be signed in to change notification settings - Fork 315
feat(wit): add map type support #2356
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
base: main
Are you sure you want to change the base?
Conversation
|
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? |
|
@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 |
8a0b8c4 to
cd02439
Compare
Signed-off-by: Yordis Prieto <[email protected]>
cd02439 to
2487714
Compare
|
Note for self: |
alexcrichton
left a comment
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.
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.
alexcrichton
left a comment
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.
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
*.wasttests 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
Related Add a 'map<K,V>' type