Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-93356: Lay out exception handling code at end of code unit#92769

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
iritkatriel merged 31 commits intopython:mainfromiritkatriel:cold_blocks_in_backend
Jun 2, 2022

Conversation

@iritkatriel
Copy link
Member

@iritkatrieliritkatriel commentedMay 13, 2022
edited
Loading

Closes#93356.

Copy link
Member

@markshannonmarkshannon left a comment

Choose a reason for hiding this comment

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

Would it better to add awarm parameter tomark_reachable?
mark_warm,mark_cold andmark_reachable are all doing the same thing, except for which edges they follow.

@markshannon
Copy link
Member

Why does fall through from a cold block to a warm block need to be treated specially?

Unless I'm mistaken:
warm_set = reachable(follow_exception_edges=False)
reachable_set = reachable(follow_exception_edges=True)
cold_set = reachable_set - warm_set
Am I missing something?

@iritkatriel
Copy link
MemberAuthor

Why does fall through from a cold block to a warm block need to be treated specially?

Unless I'm mistaken:warm_set = reachable(follow_exception_edges=False)reachable_set = reachable(follow_exception_edges=True)cold_set = reachable_set - warm_set Am I missing something?

We can't change b->next of a block with a fallthrough.

@markshannon
Copy link
Member

We can't change b->next of a block with a fallthrough.

You could convert it to a jump and eliminate the fallthrough edge.

@iritkatriel
Copy link
MemberAuthor

We can't change b->next of a block with a fallthrough.

You could convert it to a jump and eliminate the fallthrough edge.

That's the idea. But there could already be a conditional jump there, so if we don't want to have to worry about multiple jumps in the same block for the remaining parts of the assembler, it needs to be a new block.

…gs calculated only once. don't pass compiler/assembler around as much
@iritkatriel
Copy link
MemberAuthor

Would it better to add awarm parameter tomark_reachable?
mark_warm,mark_cold andmark_reachable are all doing the same thing, except for which edges they follow.

My first version did mark_cold/warm at the same time as mark_reachable. But I had a situation where the graph changed between that time and the time when I can do the push_cold_to_end. So now mark cold/warm happens just before push_cold_to_end. I could possibly share the code though.

@iritkatrieliritkatriel marked this pull request as ready for reviewMay 30, 2022 15:51
@iritkatrieliritkatriel changed the title[WIP] backend detects cold blocks and lays them out at end of functiongh-93356: Lay out exception handling code at end of code unitMay 30, 2022
Comment on lines 7472 to 7487
while(b&&b->b_next) {
basicblock*next=b->b_next;
if (next->b_cold) {
if (next->b_next) {
b->b_next=next->b_next;
next->b_next=NULL;
tail->b_next=next;
tail=next;
}
}else {
b=next;
}
if(next==origtail) {
break;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This took me a while to understand, but maybe that's just the nature of linked list code.

My biggest confusion was that meaningful fallthroughb_next linkages are broken and then re-established. There could maybe be an inner loop to scan for streaks of cold blocks, so that they can all be moved to the end with an assignment each tob.b_next, tail.b_next, last_of_streak.b_next, but I'm not sure if that makes the edge cases easier or harder.

iritkatriel reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I think the new version is easier to follow. Let me know.

sweeneyde reacted with thumbs up emoji
@sweeneyde
Copy link
Member

LGTM. I think the linked list change is clearer now, thanks.

@iritkatrieliritkatriel added the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelJun 1, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@iritkatriel for commit6a454c8 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelJun 1, 2022
@iritkatriel
Copy link
MemberAuthor

Buildbots are happy. 🍾

sweeneyde reacted with hooray emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@markshannonmarkshannonmarkshannon left review comments

@sweeneydesweeneydesweeneyde left review comments

@brandtbucherbrandtbucherAwaiting requested review from brandtbucher

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Lay out exception handling code at end of code unit

4 participants

@iritkatriel@markshannon@sweeneyde@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp