summaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-12-14 18:22:44 +0000
committerGitHub <noreply@github.com>2021-12-14 18:22:44 +0000
commit9f8f45144b6f0ad481e80570538cce89b414f7f9 (patch)
treebde67ec27794633c1e58d7349be4bf16687a1949 /Doc
parentd60457a6673cf0263213c2f2be02c633ec2e2038 (diff)
downloadcpython-git-9f8f45144b6f0ad481e80570538cce89b414f7f9.tar.gz
bpo-44525: Split calls into PRECALL and CALL (GH-30011)
* Add 3 new opcodes for calls: PRECALL_METHOD, CALL_NO_KW, CALL_KW. * Update specialization to handle new CALL opcodes. * Specialize call to method descriptors. * Remove old CALL opcodes: CALL_FUNCTION, CALL_METHOD, CALL_METHOD_KW, CALL_FUNCTION_KW.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/dis.rst47
1 files changed, 15 insertions, 32 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 7ac5a9b1f5..35d9baadf6 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -36,7 +36,7 @@ the following command can be used to display the disassembly of
>>> dis.dis(myfunc)
2 0 LOAD_GLOBAL 0 (len)
2 LOAD_FAST 0 (alist)
- 4 CALL_FUNCTION 1
+ 4 CALL_NO_KW 1
6 RETURN_VALUE
(The "2" is a line number).
@@ -104,7 +104,7 @@ Example::
...
LOAD_GLOBAL
LOAD_FAST
- CALL_FUNCTION
+ CALL_NO_KW
RETURN_VALUE
@@ -616,7 +616,7 @@ iterations of the loop.
.. opcode:: LOAD_BUILD_CLASS
Pushes :func:`builtins.__build_class__` onto the stack. It is later called
- by :opcode:`CALL_FUNCTION` to construct a class.
+ by :opcode:`CALL_NO_KW` to construct a class.
.. opcode:: BEFORE_WITH (delta)
@@ -1039,21 +1039,20 @@ All of the following opcodes use their arguments.
with ``__cause__`` set to ``TOS``)
-.. opcode:: CALL_FUNCTION (argc)
+.. opcode:: CALL_NO_KW (argc)
Calls a callable object with positional arguments.
*argc* indicates the number of positional arguments.
The top of the stack contains positional arguments, with the right-most
argument on top. Below the arguments is a callable object to call.
- ``CALL_FUNCTION`` pops all arguments and the callable object off the stack,
+ ``CALL_NO_KW`` pops all arguments and the callable object off the stack,
calls the callable object with those arguments, and pushes the return value
returned by the callable object.
- .. versionchanged:: 3.6
- This opcode is used only for calls with positional arguments.
+ .. versionadded:: 3.11
-.. opcode:: CALL_FUNCTION_KW (argc)
+.. opcode:: CALL_KW (argc)
Calls a callable object with positional (if any) and keyword arguments.
*argc* indicates the total number of positional and keyword arguments.
@@ -1063,13 +1062,11 @@ All of the following opcodes use their arguments.
in the order corresponding to the tuple.
Below that are positional arguments, with the right-most parameter on
top. Below the arguments is a callable object to call.
- ``CALL_FUNCTION_KW`` pops all arguments and the callable object off the stack,
+ ``CALL_KW`` pops all arguments and the callable object off the stack,
calls the callable object with those arguments, and pushes the return value
returned by the callable object.
- .. versionchanged:: 3.6
- Keyword arguments are packed in a tuple instead of a dictionary,
- *argc* indicates the total number of arguments.
+ .. versionadded:: 3.11
.. opcode:: CALL_FUNCTION_EX (flags)
@@ -1099,30 +1096,16 @@ All of the following opcodes use their arguments.
.. versionadded:: 3.7
-.. opcode:: CALL_METHOD (argc)
-
- Calls a method. *argc* is the number of positional arguments.
- Keyword arguments are not supported. This opcode is designed to be used
- with :opcode:`LOAD_METHOD`. Positional arguments are on top of the stack.
- Below them, the two items described in :opcode:`LOAD_METHOD` are on the
- stack (either ``self`` and an unbound method object or ``NULL`` and an
- arbitrary callable). All of them are popped and the return value is pushed.
-
- .. versionadded:: 3.7
-
-
-.. opcode:: CALL_METHOD_KW (argc)
+.. opcode:: PRECALL_METHOD (argc)
- Calls a method in a similar fashion as :opcode:`CALL_METHOD`, but also supports keyword arguments.
- *argc* is the number of positional and keyword arguments.
- This opcode is designed to be used with :opcode:`LOAD_METHOD`. TOS is a
- tuple of keyword argument names. Argument values are below that.
- Below them, the two items described in :opcode:`LOAD_METHOD` are on the
- stack (either ``self`` and an unbound method object or ``NULL`` and an
- arbitrary callable). All of them are popped from the stack and the return value is pushed.
+ Prefixes either :opcode:`CALL_NO_KW` or :opcode:`CALL_KW`.
+ This opcode is designed to be used with :opcode:`LOAD_METHOD`.
+ Sets internal variables, so that :opcode:`CALL_NO_KW` or :opcode:`CALL_KW`
+ clean up after :opcode:`LOAD_METHOD` correctly.
.. versionadded:: 3.11
+
.. opcode:: MAKE_FUNCTION (flags)
Pushes a new function object on the stack. From bottom to top, the consumed