Skip to content

Function references implementation for Wasmtime#6441

Closed
alexcrichton wants to merge 108 commits intobytecodealliance:mainfrom
alexcrichton:function-references
Closed

Function references implementation for Wasmtime#6441
alexcrichton wants to merge 108 commits intobytecodealliance:mainfrom
alexcrichton:function-references

Conversation

@alexcrichton
Copy link
Member

This is #5288 but with some more commits I've added onto the end to handle some comments I've noted during a "final" review pass. I think that everything should be in order now and there should be FIXME comments on major ticket items still remaining to do after this PR.

I've opened this as a second PR to provide my assistance in pushing this over the finish line. Many of my comments were relatively minor or stuff I would want to do quickly in a follow-up to help future-proof things as well so I figured I'd go ahead and make the changes here. The vast majority of this work is still Luna's and Daniel's!

dhil and others added 30 commits November 16, 2022 22:40
- Always support Index in blocktypes
- Support Index as table type by pretending to be Func
- Etc
This will ultimately be reverted when we refer to
wasm-tools#function-references, which doesn't have peek, but does have type
annotations on CallRef
There certainly need to be many more, but this at least catches the bugs fixed
in the next commit
dhil and others added 14 commits May 23, 2023 13:50
This isn't only used for null references
Don't initialize non-nullable locals to null, instead skip
initialization entirely and wasm validation will ensure it's always
initialized in the scope where it's used.
Use a `SignatureIndex` instead of a `u32` which while not 100% correct
should be more correct. This additionally renames the `Index` variant to
`TypedFunc` to leave space for future types which aren't functions to
not all go into an `Index` variant.

This required updates to Winch because `wasmtime_environ` types can no
longer be converted back to their `wasmparser` equivalents. Additionally
this means that all type translation needs to go through some form of
context to resolve indices which is now encapsulated in a `TypeConvert`
trait implemented in various locations.
Reduce some duplication and simplify some data structures to have a more
direct form of table initialization and a bit more graceful handling of
element-initialized tables. Additionally element-initialize tables are
now treated the same as if there's a large element segment initializing
them.
@alexcrichton alexcrichton requested review from a team as code owners May 23, 2023 20:21
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team May 23, 2023 20:21
@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:wasm wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime labels May 23, 2023
@github-actions
Copy link

Subscribe to Label Action

cc @peterhuene

Details This issue or pull request has been labeled: "cranelift", "cranelift:wasm", "wasmtime:api", "wasmtime:config"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@github-actions
Copy link

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

  • If you added a new Config method, you wrote extensive documentation for
    it.

    Details

    Our documentation should be of the following form:

    Short, simple summary sentence.
    
    More details. These details can be multiple paragraphs. There should be
    information about not just the method, but its parameters and results as
    well.
    
    Is this method fallible? If so, when can it return an error?
    
    Can this method panic? If so, when does it panic?
    
    # Example
    
    Optional example here.
    
  • If you added a new Config method, or modified an existing one, you
    ensured that this configuration is exercised by the fuzz targets.

    Details

    For example, if you expose a new strategy for allocating the next instance
    slot inside the pooling allocator, you should ensure that at least one of our
    fuzz targets exercises that new strategy.

    Often, all that is required of you is to ensure that there is a knob for this
    configuration option in wasmtime_fuzzing::Config (or one
    of its nested structs).

    Rarely, this may require authoring a new fuzz target to specifically test this
    configuration. See our docs on fuzzing for more details.

  • If you are enabling a configuration option by default, make sure that it
    has been fuzzed for at least two weeks before turning it on by default.


Details

To modify this label's message, edit the .github/label-messager/wasmtime-config.md file.

To add new label messages or remove existing label messages, edit the
.github/label-messager.json configuration file.

Learn more.

@alexcrichton
Copy link
Member Author

Actually, on second though, I'm going to do my PR-the-PR strategy instead of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:wasm cranelift Issues related to the Cranelift code generator wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:config Issues related to the configuration of Wasmtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants