Thanks to visit codestin.com
Credit goes to github.com

Skip to content

GH-132532: Make CHECK_PERIODIC an instruction, not just a uop. #135772

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Jun 20, 2025

This is a reimplementation of #132533 (which I forgot about, sorry @iritkatriel) but with support for CALL_KW, CALL_FUNCTION_EX and a tier2 version that doesn't escape.

Initial benchmarking was about 0.5% slower across the platforms.

Stats showed that CHECK_PERIODIC was 7.1% of all instructions.

To mitigate this, this PR also:

  • Tracks if CHECK_PERIODIC has been emitted in a basic block, and not emit it twice without an intervening call.
  • Skips over CHECK_PERIODIC in CALL_PY_EXACT_ARGS and CALL_PY_GENERAL as they will have checked the eval breaker.
  • Modifies CALL_LIST_APPEND to check the eval breaker or this loop might never check the eval breaker:
for i in x:
   seq.append(i)

📚 Documentation preview 📚: https://cpython-previews--135772.org.readthedocs.build/

@markshannon markshannon changed the title GH_132532: Make CHECK_PERIODIC an instruction, not just a uop. GH-132532: Make CHECK_PERIODIC an instruction, not just a uop. Jun 20, 2025
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.

1 participant