Skip to content

GH-116596: Better determination of escaping uops. #116597

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

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Mar 11, 2024

Any uop marked as escaping forces a _SET_IP before it and a _CHECK_VALIDITY afterwards, which is expensive.
This PR removes some false positives, where a uop is marked as escaping but does not.

@@ -463,7 +463,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
last->opcode == _COPY
) {
last->opcode = _NOP;
buffer[pc].opcode = NOP;
buffer[pc].opcode = _NOP;
Copy link
Contributor

Choose a reason for hiding this comment

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

NOP vs. _NOP... I hope the difference between those two is documented somewhere1 😄

Footnotes

  1. After a quick git grep I could not figure out the semantic difference between them.

Copy link
Member

Choose a reason for hiding this comment

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

In Tier 1 it's NOP. In Tier 2 it's _NOP. The original code worked because they are currently the same value (as are all opcodes that are shared between T1 and T2). But eventually we may want all the Tier 2 opcodes to be distinct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the clarification!

adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 25, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 17, 2024
@markshannon markshannon deleted the fewer-escapes branch August 6, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants