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

GH-111485: Increment next_instr consistently at the start of the instruction. #111486

Merged

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Oct 30, 2023

This PR:

  • Generates the code to set next_instr correct at the start of the generated instruction, and (when needed) generates this_instr which points to the current instruction.
  • Ensures that all instructions have a this_instr variable pointing to the instruction, and next_instr actually points to the next instruction.
  • Uses this_instr throughout which means we don't need to do manual size calculations.


self.check_events(func, recorders = JUMP_AND_BRANCH_RECORDERS, expected = [
('branch', 'func', 2, 2),
('branch', 'func', 3, 4),
('branch', 'func', 3, 6),
Copy link
Member Author

Choose a reason for hiding this comment

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

This is now correct. See #109038 (comment)

@@ -1434,7 +1436,7 @@ def func():
('line', 'meth', 1),
('jump', 'func', 5, 5),
('jump', 'func', 5, '[offset=114]'),
('branch', 'func', '[offset=120]', '[offset=122]'),
('branch', 'func', '[offset=120]', '[offset=124]'),
Copy link
Member Author

Choose a reason for hiding this comment

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

Likewise

@markshannon markshannon merged commit d27acd4 into python:main Oct 31, 2023
30 of 31 checks passed
FullteaR pushed a commit to FullteaR/cpython that referenced this pull request Nov 3, 2023
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
@markshannon markshannon deleted the increment-next-instr-consistently branch August 6, 2024 10:17
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
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.

2 participants