Skip to content
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

stage2-wasm: implement AIR handling for labeled switch/continue #21450

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pavelverigo
Copy link
Contributor

Read commit messages.

Old code could not handle > 32 bits case + there were no test case for this so I added one.
By mostly purging previous logic, I deleted special handling of non-sparse switch case branching, which were emitting .br_table for wasm VM level optimisation. I think we do not need this complexity for debug wasm backend.
@pavelverigo
Copy link
Contributor Author

@mlugg @Luukdegram

@mlugg
Copy link
Member

mlugg commented Sep 18, 2024

this is luuk's area, i know next to nothing about this backend lol
but, in anticipation: nice work!

@mlugg
Copy link
Member

mlugg commented Sep 18, 2024

By mostly purging previous logic, I deleted special handling of non-sparse switch case branching, which were emitting .br_table for wasm VM level optimisation. I think we do not need this complexity for debug wasm backend.

The self-hosted backends are not just for debug builds; that's the initial focus, but our goal is to eventually provide optimization passes to make them useful for release builds too. It's currently unclear what this will look like implementation-wise, but I don't like the idea of eliminating existing optimized lowerings for (AFAICT) no real gain.

@pavelverigo
Copy link
Contributor Author

this is luuk's area, i know next to nothing about this backend lol but, in anticipation: nice work!

I thought you did implement airRepeat handling because of this commit cb68c09?

@mlugg
Copy link
Member

mlugg commented Sep 18, 2024

No, Luuk wrote most of that commit, the authorship information unfortunately was unintentionally lost through some cherry-picks and squashes I did.

@pavelverigo
Copy link
Contributor Author

pavelverigo commented Sep 18, 2024

By mostly purging previous logic, I deleted special handling of non-sparse switch case branching, which were emitting .br_table for wasm VM level optimisation. I think we do not need this complexity for debug wasm backend.

The self-hosted backends are not just for debug builds; that's the initial focus, but our goal is to eventually provide optimization passes to make them useful for release builds too. It's currently unclear what this will look like implementation-wise, but I don't like the idea of eliminating existing optimized lowerings for (AFAICT) no real gain.

I am myself a proponent of even having some simple optimization in debug build for performance. But in the WASM backend context, because any reasonable VM implementation does advanced control-flow analysis during lowering to native code, the benefit is miniscule.

@andrewrk
Copy link
Member

It doesn't matter. Zig's task is to output the best wasm code given the constraints (optimization mode, cpu features, etc).

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