Skip to content

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

Merged
markshannon merged 7 commits into
python:mainfrom
faster-cpython:increment-next-instr-consistently
Oct 31, 2023
Merged

markshannon merged 7 commits into
python:mainfrom
faster-cpython:increment-next-instr-consistently

Conversation

@markshannon

@markshannon markshannon commented Oct 30, 2023 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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)

('jump', 'func', 5, 5),
('jump', 'func', 5, '[offset=114]'),
('branch', 'func', '[offset=120]', '[offset=122]'),
('branch', 'func', '[offset=120]', '[offset=124]'),

Copy link
Copy Markdown
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
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

2 participants