Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 3 additions & 13 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1102,11 +1102,6 @@ iterations of the loop.
Pushes ``co_consts[consti]`` onto the stack.


.. opcode:: LOAD_CONST_IMMORTAL (consti)

Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects.


.. opcode:: LOAD_SMALL_INT (i)

Pushes the integer ``i`` onto the stack.
Expand Down Expand Up @@ -1968,14 +1963,15 @@ but are replaced by real opcodes or removed before bytecode is generated.
Marks the end of the code block associated with the last ``SETUP_FINALLY``,
``SETUP_CLEANUP`` or ``SETUP_WITH``.


.. opcode:: JUMP
.. opcode:: JUMP_NO_INTERRUPT
JUMP_NO_INTERRUPT

Undirected relative jump instructions which are replaced by their
directed (forward/backward) counterparts by the assembler.

.. opcode:: JUMP_IF_TRUE
.. opcode:: JUMP_IF_FALSE
JUMP_IF_FALSE

Conditional jumps which do not impact the stack. Replaced by the sequence
``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``.
Expand All @@ -1991,12 +1987,6 @@ but are replaced by real opcodes or removed before bytecode is generated.
This opcode is now a pseudo-instruction.


.. opcode:: LOAD_METHOD
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 was removed in #119677 (ae9140f) but not from documentation.


Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode
with a flag set in the arg.


.. _opcode_collections:

Opcode collections
Expand Down
72 changes: 71 additions & 1 deletion Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2800,9 +2800,79 @@
CPython bytecode changes
========================

* Replaced the opcode ``BINARY_SUBSCR`` by :opcode:`BINARY_OP` with oparg ``NB_SUBSCR``.
* Replaced the opcode :opcode:`!BINARY_SUBSCR` by the :opcode:`BINARY_OP`
opcode with the ``NB_SUBSCR`` oparg.
(Contributed by Irit Katriel in :gh:`100239`.)

* Add the :opcode:`BUILD_INTERPOLATION` & :opcode:`BUILD_TEMPLATE`
opcodes to construct new :class:`~string.templatelib.Interpolation`
and :class:`~string.templatelib.Template` instances, respectively.
(Contributed by Lysandros Nikolaou and others in :gh:`132661`;
see also :ref:`PEP 750: Template strings <whatsnew314-pep750>`).

* Remove the :opcode:`!BUILD_CONST_KEY_MAP` opcode.
Use :opcode:`BUILD_MAP` instead.
(Contributed by Mark Shannon in :gh:`122160`.)

* Replace the :opcode:`!LOAD_ASSERTION_ERROR` opcode with
:opcode:`LOAD_COMMON_CONSTANT` and add support for loading
:exc:`NotImplementedError`.

* Add the :opcode:`LOAD_FAST_BORROW` & :opcode:`LOAD_FAST_BORROW_LOAD_FAST_BORROW`
opcodes to reduce reference counting overhead when the interpreter can prove
that the reference in the frame outlives the reference loaded onto the stack.
(Contributed by Matt Page in :gh:`130704`.)

* Add the :opcode:`LOAD_SMALL_INT` opcode, which pushes a small integer
equal to the ``oparg`` to the stack.
The :opcode:`!RETURN_CONST` opcode is removed as it is no longer used.
(Contributed by Mark Shannon in :gh:`125837`.)

* Add the new :opcode:`LOAD_SPECIAL` instruction.
Generate code for :keyword:`with` and :keyword:`async with` statements
using the new instruction.
Removed the :opcode:`!BEFORE_WITH` and :opcode:`!BEFORE_ASYNC_WITH` instructions.
(Contributed by Mark Shannon in :gh:`120507`.)

* Add the :opcode:`POP_ITER` opcode to support 'virtual' iterators.
(Contributed by Mark Shannon in :gh:`132554`.)

Pseudo-instructions
-------------------

* Add the :opcode:`!ANNOTATIONS_PLACEHOLDER` pseudo instruction
to support partially executed module-level annotations with
:ref:`deferred evaluation of annotations <whatsnew314-pep649>`.
(Contributed by Jelle Zijlstra in :gh:`130907`.)

* Add the :opcode:`BINARY_OP_EXTEND` pseudo instruction,

Check warning on line 2848 in Doc/whatsnew/3.14.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

'opcode' reference target not found: BINARY_OP_EXTEND [ref.opcode]
which executes a pair of functions (guard and specialization functions)
accessed from the inline cache.
(Contributed by Irit Katriel in :gh:`100239`.)

* Add three specialisations for :opcode:`CALL_KW`;
:opcode:`!CALL_KW_PY` for calls to Python functions,
:opcode:`!CALL_KW_BOUND_METHOD` for calls to bound methods, and
:opcode:`!CALL_KW_NON_PY` for all other calls.
(Contributed by Mark Shannon in :gh:`118093`.)

* Add the :opcode:`JUMP_IF_TRUE` and :opcode:`JUMP_IF_FALSE` pseudo instructions,
conditional jumps which do not impact the stack.
Replaced by the sequence ``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``.
(Contributed by Irit Katriel in :gh:`124285`.)

* Add the :opcode:`LOAD_CONST_MORTAL` pseudo instruction.

Check warning on line 2864 in Doc/whatsnew/3.14.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

'opcode' reference target not found: LOAD_CONST_MORTAL [ref.opcode]
(Contributed by Mark Shannon in :gh:`128685`.)

* Add the :opcode:`!LOAD_CONST_IMMORTAL` pseudo instruction,
which does the same as :opcode:`!LOAD_CONST`, but is more efficient
for immortal objects.
(Contributed by Mark Shannon in :gh:`125837`.)

* Add the :opcode:`NOT_TAKEN` pseudo instruction, used by :mod:`sys.monitoring`
to record branch events (i.e. :monitoring-event:`BRANCH_LEFT`).
(Contributed by Mark Shannon in :gh:`122548`.)


C API changes
=============
Expand Down
2 changes: 1 addition & 1 deletion Misc/NEWS.d/3.14.0a2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ The :class:`memoryview` type now supports subscription, making it a
.. nonce: KlCdgD
.. section: Core and Builtins
Adds :opcode:`LOAD_SMALL_INT` and :opcode:`LOAD_CONST_IMMORTAL`
Adds :opcode:`LOAD_SMALL_INT` and :opcode:`!LOAD_CONST_IMMORTAL`
instructions. ``LOAD_SMALL_INT`` pushes a small integer equal to the
``oparg`` to the stack. ``LOAD_CONST_IMMORTAL`` does the same as
``LOAD_CONST`` but is more efficient for immortal objects. Removes
Expand Down
Loading