-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[RyuJit Wasm] fix off by one error for br_table #123565
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -566,7 +566,7 @@ void CodeGen::genTableBasedSwitch(GenTree* treeNode) | |
| assert(caseCount > 0); | ||
| assert(desc->HasDefaultCase()); | ||
|
|
||
| GetEmitter()->emitIns_I(INS_br_table, EA_4BYTE, caseCount); | ||
| GetEmitter()->emitIns_I(INS_br_table, EA_4BYTE, caseCount - 1); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you potentially add a comment here explaining that this loop will handle emitting all the targets, including the default, even though in the above count we excluded it because of Wasm's convention? We could also consider pulling emitting the default out of the loop just to be extra clear here, though I know we also have the assert above to ensure we do have a default case.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Take another look. |
||
| for (unsigned caseNum = 0; caseNum < caseCount; caseNum++) | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.