fitzgen requested alexcrichton for a review on PR #9401.
fitzgen requested wasmtime-core-reviewers for a review on PR #9401.
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.test
s 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:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
fitzgen updated PR #9401.
alexcrichton submitted PR review:
Thanks for all the helpful comments!
alexcrichton created PR review comment:
Could this be replaced with
.top_type() == Something
?
fitzgen updated PR #9401.
fitzgen submitted PR review.
fitzgen created PR review comment:
ah yes, good call
fitzgen updated PR #9401.
fitzgen has enabled auto merge for PR #9401.
fitzgen updated PR #9401.
fitzgen merged PR #9401.
Last updated: Dec 23 2024 at 12:05 UTC