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

make EndSwitch flush cases to the EndSwitch offset #6072

Merged
merged 1 commit into from
Apr 9, 2019

Conversation

MikeHolman
Copy link
Contributor

This makes it so that if targetOffset is breaking out of a loop we won't have problems (could happen in wasm).

Now cases will go to EndSwitch, which just does direct branch to targetOffset. In normal cases, that will be cleaned up by RetargetBrToBr peep, so codegen doesn't change.

Fixes #6037

@@ -163,7 +163,7 @@ SwitchIRBuilder::BeginSwitch()
void
SwitchIRBuilder::EndSwitch(uint32 offset, uint32 targetOffset)
{
FlushCases(targetOffset);
FlushCases(offset);
AssertMsg(m_caseNodes->Count() == 0, "Not all switch case nodes built by end of switch");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is offset/targetOffset here ? (I don't know this code)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offset is the location of the EndSwitch instruction. targetOffset is the location that EndSwitch branches to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. LGTM.

@chakrabot chakrabot merged commit 524b9b0 into chakra-core:master Apr 9, 2019
chakrabot pushed a commit that referenced this pull request Apr 9, 2019
… offset

Merge pull request #6072 from MikeHolman:endswitchbug

This makes it so that if targetOffset is breaking out of a loop we won't have problems (could happen in wasm).

Now cases will go to EndSwitch, which just does direct branch to targetOffset. In normal cases, that will be cleaned up by RetargetBrToBr peep, so codegen doesn't change.

Fixes #6037
chakrabot pushed a commit that referenced this pull request Apr 23, 2019
…o the EndSwitch offset

Merge pull request #6096 from MikeHolman:endswitch_1.11

Cherry-picking #6072 to release/1.11
chakrabot pushed a commit that referenced this pull request Apr 23, 2019
… flush cases to the EndSwitch offset

Merge pull request #6096 from MikeHolman:endswitch_1.11

Cherry-picking #6072 to release/1.11
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