Stream: git-wasmtime

Topic: wasmtime / PR #9401 Implement the `ref.test` Wasm GC inst...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:20):

fitzgen requested alexcrichton for a review on PR #9401.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:20):

fitzgen requested wasmtime-core-reviewers for a review on PR #9401.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:20):

fitzgen opened PR #9401 from fitzgen:ref-test to bytecodealliance:main:

This commit implements the ref.test instruction, which tests whether a reference is of a given type.

We implement inline fast paths for abstract types, but currently rely on an out-of-line libcall for concrete types in the general case. This is known to be suboptimal. (FWIW, we also emit a fast path in front of the libcall where we first check the actual type and expected type for equality and skip the libcall if they are equal.)

This implementation is expected to be improved in the future by exposing a module's types' supertypes arrays to Wasm, so that the Wasm can do the O(1) subtype checks inline. This will make the vast majority of all ref.tests inlinable. After that, the only remaining case that would require out-of-line libcalls would be when a module is given an instance of a type that it did not itself define (but which could be a subtype of a type it defined, for example, and which itself might not even have been defined until after this module's instance was created!)

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:31):

fitzgen updated PR #9401.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:39):

alexcrichton submitted PR review:

Thanks for all the helpful comments!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:39):

alexcrichton created PR review comment:

Could this be replaced with .top_type() == Something?

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:42):

fitzgen updated PR #9401.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:42):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:42):

fitzgen created PR review comment:

ah yes, good call

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:45):

fitzgen updated PR #9401.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:45):

fitzgen has enabled auto merge for PR #9401.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 21:58):

fitzgen updated PR #9401.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 08 2024 at 22:23):

fitzgen merged PR #9401.


Last updated: Nov 22 2024 at 17:03 UTC