Skip to content

Wasm ICs / typed-funcrefs test: switch to nullable table.#8161

Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom
cfallin:typed-funcref-ics-test-update
Mar 18, 2024
Merged

Wasm ICs / typed-funcrefs test: switch to nullable table.#8161
alexcrichton merged 1 commit intobytecodealliance:mainfrom
cfallin:typed-funcref-ics-test-update

Conversation

@cfallin
Copy link
Copy Markdown
Member

@cfallin cfallin commented Mar 17, 2024

This is based on discussion in #8158: as noted in #8160, if we use a nullable typed funcref table instead (and given that we know we'll initialize a particular slot before use on the application side, so we won't actually call a null ref), and if we have a null-ref default value, we should be able to avoid the lazy table-init mechanism entirely.

(Ignore the part where this module doesn't actually have any update logic that would set non-null refs anywhere; it's a compile-test, not a runtest!)

Once #8159 is merged and #8160 is implemented (and table-at-constant-index is fully optimized), we should see zero branches in this test.

@cfallin cfallin requested a review from alexcrichton March 17, 2024 21:07
@cfallin cfallin requested a review from a team as a code owner March 17, 2024 21:07
@cfallin cfallin changed the title Wasm ICs / typed-funcrefs test: switch to call_indirect and nullabl… Wasm ICs / typed-funcrefs test: switch to call_indirect and nullable table. Mar 17, 2024
This is based on discussion in bytecodealliance#8158: as noted in bytecodealliance#8160, if we use a
nullable typed funcref table instead (and given that we know we'll
initialize a particular slot before use on the application side, so we
won't actually call a null ref), and if we have a null-ref default
value, we should be able to avoid the lazy table-init mechanism
entirely.

(Ignore the part where this module doesn't actually have any update
logic that would set non-null refs anywhere; it's a compile-test, not a
runtest!)

Once bytecodealliance#8159 is merged and bytecodealliance#8160 is implemented, we should see zero
branches in this test.
@cfallin cfallin force-pushed the typed-funcref-ics-test-update branch from 1667a14 to 7831fee Compare March 17, 2024 21:23
@cfallin cfallin changed the title Wasm ICs / typed-funcrefs test: switch to call_indirect and nullable table. Wasm ICs / typed-funcrefs test: switch to nullable table. Mar 17, 2024
@cfallin
Copy link
Copy Markdown
Member Author

cfallin commented Mar 17, 2024

(I switched back from call_indirect to table.get + call_ref because it seems the former doesn't actually omit callee signature checks even when the callee is a typed funcref)

Copy link
Copy Markdown
Contributor

@jameysharp jameysharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. The collection of optimizations we're discussing should be easy and should show up very well on this test. I'm looking forward to seeing each one shrink this!

@alexcrichton
Copy link
Copy Markdown
Member

it seems the former doesn't actually omit callee signature checks even when the callee is a typed funcref

Ah yes I didn't mean to imply that we already did it, only that it's not too hard to add. I've got a commit after #8159 which implements the optimization and the codegen for call_indirect vs table.get + call_ref is the same after that.

@alexcrichton alexcrichton added this pull request to the merge queue Mar 18, 2024
Merged via the queue into bytecodealliance:main with commit 82c26c0 Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants