-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement the
ref.test
Wasm GC instruction (#9401)
* Implement the `ref.test` Wasm GC instruction 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!) * fix no-gc build * Re-add should-fail test, due to instructions that still aren't implemented * check for the `any` type hierarchy via `.top()` * Add a couple more small comments * rename internal ref.test test to avoid should-pass vs should-fail confusion between similarly named spec test
- Loading branch information
Showing
20 changed files
with
1,494 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.