summaryrefslogtreecommitdiffstats
path: root/Doc/library/dis.rst
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-06-04 00:03:54 (GMT)
committerGitHub <noreply@github.com>2021-06-04 00:03:54 (GMT)
commitb2bf2bc1ece673d387341e06c8d3c2bc6e259747 (patch)
tree29217a2927ed27e71e6324876f279946219a25a9 /Doc/library/dis.rst
parent35002aa8f62dda1f79035e9904abdf476683e9be (diff)
downloadcpython-b2bf2bc1ece673d387341e06c8d3c2bc6e259747.zip
cpython-b2bf2bc1ece673d387341e06c8d3c2bc6e259747.tar.gz
cpython-b2bf2bc1ece673d387341e06c8d3c2bc6e259747.tar.bz2
bpo-43693: Compute deref offsets in compiler (gh-25152)
Merges locals and cells into a single array. Saves a pointer in the interpreter and means that we don't need the LOAD_CLOSURE opcode any more https://bugs.python.org/issue43693
Diffstat (limited to 'Doc/library/dis.rst')
-rw-r--r--Doc/library/dis.rst29
1 files changed, 23 insertions, 6 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index eaa001c..bc206f7 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -1058,16 +1058,24 @@ All of the following opcodes use their arguments.
.. opcode:: LOAD_CLOSURE (i)
- Pushes a reference to the cell contained in slot *i* of the cell and free
- variable storage. The name of the variable is
- ``co_fastlocalnames[i + len(co_varnames)]``.
+ Pushes a reference to the cell contained in slot ``i`` of the "fast locals"
+ storage. The name of the variable is ``co_fastlocalnames[i]``.
+
+ Note that ``LOAD_CLOSURE`` is effectively an alias for ``LOAD_FAST``.
+ It exists to keep bytecode a little more readable.
+
+ .. versionchanged:: 3.11
+ ``i`` is no longer offset by the length of ``co_varnames``.
.. opcode:: LOAD_DEREF (i)
- Loads the cell contained in slot *i* of the cell and free variable storage.
+ Loads the cell contained in slot ``i`` of the "fast locals" storage.
Pushes a reference to the object the cell contains on the stack.
+ .. versionchanged:: 3.11
+ ``i`` is no longer offset by the length of ``co_varnames``.
+
.. opcode:: LOAD_CLASSDEREF (i)
@@ -1077,20 +1085,29 @@ All of the following opcodes use their arguments.
.. versionadded:: 3.4
+ .. versionchanged:: 3.11
+ ``i`` is no longer offset by the length of ``co_varnames``.
+
.. opcode:: STORE_DEREF (i)
- Stores TOS into the cell contained in slot *i* of the cell and free variable
+ Stores TOS into the cell contained in slot ``i`` of the "fast locals"
storage.
+ .. versionchanged:: 3.11
+ ``i`` is no longer offset by the length of ``co_varnames``.
+
.. opcode:: DELETE_DEREF (i)
- Empties the cell contained in slot *i* of the cell and free variable storage.
+ Empties the cell contained in slot ``i`` of the "fast locals" storage.
Used by the :keyword:`del` statement.
.. versionadded:: 3.2
+ .. versionchanged:: 3.11
+ ``i`` is no longer offset by the length of ``co_varnames``.
+
.. opcode:: RAISE_VARARGS (argc)