[WIP] lay out cold blocks at end of function#91804
[WIP] lay out cold blocks at end of function#91804iritkatriel wants to merge 6 commits intopython:mainfrom
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: