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

[wasm] Generate bailouts for switch opcodes in jiterpreter instead of aborting #107323

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

kg
Copy link
Contributor

@kg kg commented Sep 3, 2024

Right now none of the jiterpreter support code knows how to decode switch opcodes since they're variable length - hitting one causes codegen to just halt. This is undesirable since the switch might be in an unlikely-to-execute block, i.e. an error handler.

As a first step this PR implements the size calculation algorithm for interpreter switches and turns them into an unconditional bailout, so codegen can continue past them.

In the future to implement switches we'd need to update the logic that finds branch targets so it can see 'into' switches and enumerate all their potential branch targets, and then pair that with jiterp codegen that produces a wasm jump table with the right displacements. We'd probably want to limit that to switches of a certain size and only do it after the trace size limit has been raised.

…es instead of aborting the trace

Better diagnostic output when jiterp hits an invalid opcode
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

@lewing
Copy link
Member

lewing commented Sep 4, 2024

should we backport this?

@kg
Copy link
Contributor Author

kg commented Sep 5, 2024

We can, but it's simultaneously not-zero-risk and probably not high-value

radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Sep 6, 2024
…es instead of aborting the trace (dotnet#107323)

Better diagnostic output when jiterp hits an invalid opcode
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 17, 2024
…es instead of aborting the trace (dotnet#107323)

Better diagnostic output when jiterp hits an invalid opcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants