Skip to content

[Wasm GC] RefIs / RefEq / RefTest all return a boolean #4786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 8, 2022
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Jul 8, 2022

This marks all reference operations that return 0/1 as doing so. This
allows various bitwise operations to be optimized on them.

This also marks StringEq as a boolean, though we can't test that fully yet
as Strings support is wip (no interpreter or other stuff yet).

As a driveby this moves emitsBoolean to its own file, and uses it
in getMaxBits to avoid redundancy (the redundant code paths now have
a WASM_UNREACHABLE). I could do that in a prior PR if you prefer but it
seems trivial?

This removes 14% of all select operations on j2wasm. Those selects
are x ? 1 : 0 which we turn into x if the input is already a boolean.

@kripken kripken requested review from tlively and aheejin July 8, 2022 20:33
@kripken
Copy link
Member Author

kripken commented Jul 8, 2022

(Also 5% of selects on Dart.)

@kripken kripken merged commit 44fa122 into main Jul 8, 2022
@kripken kripken deleted the boolean branch July 8, 2022 23:16
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.

2 participants