FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GH-90997: Document `CACHE`s by brandtbucher · Pull Request #95694 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rst  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 18 additions & 0 deletions Doc/library/dis.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,24 @@ The Python compiler currently generates the following bytecode instructions.
.. versionadded:: 3.11


.. opcode:: CACHE

Rather than being an actual instruction, this opcode is used to mark extra
space for the interpreter to cache useful data directly in the bytecode
itself. It is automatically hidden by all ``dis`` utilities, but can be
viewed with ``show_caches=True``.

Logically, this space is part of the preceding instruction. Many opcodes
expect to be followed by an exact number of caches, and will instruct the
interpreter to skip over them at runtime.

Populated caches can look like arbitrary instructions, so great care should
be taken when reading or modifying raw, adaptive bytecode containing
quickened data.

.. versionadded:: 3.11


**Unary operations**

Unary operations take the top of the stack, apply the operation, and push the
Expand Down
7 changes: 7 additions & 0 deletions Doc/whatsnew/3.11.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,13 @@ contributors are volunteers from the community.
CPython bytecode changes
========================

* The bytecode now contains inline cache entries, which take the form of
:opcode:`CACHE` instructions. Many opcodes expect to be followed by an exact
number of caches, and instruct the interpreter to skip over them at runtime.
Populated caches can look like arbitrary instructions, so great care should be
taken when reading or modifying raw, adaptive bytecode containing quickened
data.

* Replaced all numeric ``BINARY_*`` and ``INPLACE_*`` instructions with a single
:opcode:`BINARY_OP` implementation.

Expand Down

Back | FazBrowse Home | New Git URL