Skip to content
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

Post-MVP feature requests #452

Open
tlively opened this issue Oct 17, 2023 · 7 comments
Open

Post-MVP feature requests #452

tlively opened this issue Oct 17, 2023 · 7 comments
Labels
Post-MVP Ideas for Post-MVP extensions

Comments

@tlively
Copy link
Member

tlively commented Oct 17, 2023

These are the feature requests that came up at the subgroup meeting on October 3, 2023:

  1. Non-throwing variants of instructions or trap handlers
  2. Constant array.new_elem and array.new_data
  3. initialize-once globals
  4. Feature detection for experimenting with new features
  5. Type imports
  6. Controlling meta-objects/RTTs/headers
  7. Static fields
  8. Weak references
  9. Finalization
  10. Eliminate method receiver casts
  11. Ergonomic JS/WasmGC interop
  12. Arbitrary multi-byte loads and stores to byte arrays (Multibyte access to (array i8) #395
@rossberg
Copy link
Member

You meant October 12? :)

Many of those are already listed in the Post-MVP doc in some form, I'll add the others.

  1. initialize-once globals

I don't remember this one. What does it mean exactly?

@zapashcanon
Copy link
Contributor

With @chambart we're going to present our freezable/sealable proposal at the next CG meeting.

It allows to have mutable and/or nullable globals/values only during initialization phase and they become immutable and/or non-nullable after this.

initialize-once globals

It may be one of the things we are proposing.

@fitzgen
Copy link
Contributor

fitzgen commented Oct 17, 2023

Another post-MVP feature to consider would be a way to compare funcrefs for equality and/or get unique IDs for them or something.

Then I could do speculative inlining of funcrefs as a Wasm-to-Wasm pass in Winliner instead of only for call_indirects through tables that are never mutated.

@jakobkummerow
Copy link
Contributor

a way to compare funcrefs for equality

I agree that this would be useful to have.

Implementation perspective: if we expect that repeated creations of funcrefs for the same function index have distinct identity (in other words, that (ref.eq (ref.func $x) (ref.func $x)) evaluates to 0), then that would be annoying/inefficient to implement. If we specify that funcrefs are implicitly cached/canonicalized, i.e. there is only one unique funcref returned by arbitrarily many executions of (ref.func $x) for a given $x, then that would be trivial to implement -- in fact, we already make use of this property (and pointer-equality comparisons based on it) internally in V8.
(To be fair, I cannot say with certainty whether other engines might see this differently, but I would find that somewhat surprising: the obvious way how to make ref.func fast is to cache or even pre-initialize its result, so it doesn't need an allocation every time.)

@rossberg
Copy link
Member

One of the known problems with function identity is that it invalidates optimisations like specialisation or any code transformation duplicating/merging function definitions that are referenced.

@kripken
Copy link
Member

kripken commented Oct 17, 2023

Previous discussion on function comparisons: #239 , some use cases and data there from a year ago.

Overall I think this can help in the toolchain, as @fitzgen said, but I also agree with @rossberg that the downsides need to be carefully weighed here. Another thing to consider is that if VMs inline at runtime then this probably becomes less important, and for that reason I don't consider this high priority personally.

@fitzgen
Copy link
Contributor

fitzgen commented Oct 17, 2023

Another thing to consider is that if VMs inline at runtime then this probably becomes less important

FWIW, not all engines / Wasm environments have (or will ever have) JIT capabilities.

@rossberg rossberg added the Post-MVP Ideas for Post-MVP extensions label Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Post-MVP Ideas for Post-MVP extensions
Projects
None yet
Development

No branches or pull requests

6 participants