-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
[WIP] lay out cold blocks at end of function #91804
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
Conversation
Rather than have the front-end decide which blocks are cold, would it make sense for the back-end to do it? A cold block is one where all the branches to it are from |
Are we sure we only want except blocks to be cold? I was wondering if there are other cases, which the front end can identify. |
Which other blocks would be cold? |
Any block that ends with a |
I'm not sure how to detect the end of the except body. |
I thought of looking for POP_EXCEPT or POP_EXCEPT_AND_RERAISE (accounting for nesting) but I don't know if that's robust. |
There is no need to detect the end of the except body. If a basic block is cold, it is cold, it doesn't matter where it ends. What I would suggest, is to modify the code that determines reachability. This should be reasonably straightforward to implement. Have a "warm" bit and a "cold" bit. |
Yes, makes sense. |
Another option is to roll the start-cold/end-cold into the compuler_push_flock/compiler_pop_fblock calls, then it happen implicitly in the front end. |
Closing in favour of #92769. |
This pushes the except blocks to the end of the function so that there is no jump over this code when there is no exception.
Example:
Becomes:
instead of: