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

Implement re-designed Wasmi br_table instructions #1158

Merged
merged 12 commits into from
Sep 4, 2024

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Sep 2, 2024

This new br_table design fixes a pathological encoding scheme with the old br_table instruction when the branches required to copy values into different branch destination registers. The new design no longer has this pathological translation case and thus should use a lot less encoding space and be more efficient in some cases.

The downside is that this increased complexity in both, the Wasmi translator and also in the Wasmi bytecode executor to some extend. However, it could also be argued that the translation of the new br_table instructions is a bit simpler overall since the pathological case no longer has to be handled.

TODO

  • Properly emit Instruction::BranchTableTargetNonOverlapping in cases where possible.
  • Write missing docs for the new definitions.
  • New Wasmi translation unit tests featuring the new encoding schemes.

@Robbepop Robbepop mentioned this pull request Sep 2, 2024
8 tasks
This new design accounts for Wasmi `br_table`s where each `br_table` target may need to copy values to different registers before taking a branch which was an oversight in the previous design.
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 86.01695% with 99 lines in your changes missing coverage. Please review.

Project coverage is 79.76%. Comparing base (8c9f031) to head (36d197f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/wasmi/src/engine/executor/instrs/branch.rs 38.70% 38 Missing ⚠️
crates/wasmi/src/engine/executor/instrs/copy.rs 26.08% 17 Missing ⚠️
crates/wasmi/src/engine/translator/mod.rs 92.89% 15 Missing ⚠️
crates/wasmi/src/engine/executor/instrs.rs 47.61% 11 Missing ⚠️
...ates/wasmi/src/engine/translator/visit_register.rs 0.00% 9 Missing ⚠️
crates/wasmi/src/engine/bytecode/utils.rs 0.00% 4 Missing ⚠️
crates/wasmi/src/engine/executor/instrs/return_.rs 60.00% 4 Missing ⚠️
...rates/wasmi/src/engine/translator/instr_encoder.rs 97.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1158      +/-   ##
==========================================
+ Coverage   79.62%   79.76%   +0.14%     
==========================================
  Files         296      296              
  Lines       25533    25952     +419     
==========================================
+ Hits        20331    20701     +370     
- Misses       5202     5251      +49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Robbepop Robbepop marked this pull request as ready for review September 4, 2024 10:36
@Robbepop Robbepop merged commit bb62df0 into main Sep 4, 2024
18 checks passed
@Robbepop Robbepop deleted the rf-impl-new-br-table-instrs branch September 4, 2024 10:37
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.

1 participant