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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ the following command can be used to display the disassembly of
3 LOAD_GLOBAL 1 (len + NULL)
LOAD_FAST_BORROW 0 (alist)
CALL 1
CHECK_PERIODIC
RETURN_VALUE

(The "2" is a line number).
Expand Down Expand Up @@ -217,6 +218,7 @@ Example:
LOAD_GLOBAL
LOAD_FAST_BORROW
CALL
CHECK_PERIODIC
RETURN_VALUE


Expand Down Expand Up @@ -1751,6 +1753,15 @@ iterations of the loop.
.. versionadded:: 3.11


.. opcode:: CHECK_PERIODIC

Checks the eval breaker and performs periodic tasks if the eval breaker is set.
Tasks inlcude switching threads and performing GC amongst others.
All :opcode:`CALL` instructions must be followed by :opcode:`CHECK_PERIODIC`.

.. versionadded:: 3.14


.. opcode:: HAVE_ARGUMENT

This is not really an opcode. It identifies the dividing line between
Expand Down
3 changes: 2 additions & 1 deletion Include/internal/pycore_magic_number.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ Known values:
Python 3.15a1 3651 (Simplify LOAD_CONST)
Python 3.15a1 3652 (Virtual iterators)
Python 3.15a1 3653 (Fix handling of opcodes that may leave operands on the stack when optimizing LOAD_FAST)
Python 3.15a2 3654 (Add CHECK_PERIODIC opcode)


Python 3.16 will start with 3700
Expand All @@ -294,7 +295,7 @@ PC/launcher.c must also be updated.

*/

#define PYC_MAGIC_NUMBER 3653
#define PYC_MAGIC_NUMBER 3654
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
(little-endian) and then appending b'\r\n'. */
#define PYC_MAGIC_NUMBER_TOKEN \
Expand Down
81 changes: 43 additions & 38 deletions Include/internal/pycore_opcode_metadata.h

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Include/internal/pycore_uop_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

229 changes: 115 additions & 114 deletions Include/opcode_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading