8000 Sync section 25.7 with Python/compile.c (#672) · Develop-Python/devguide@df3ee1a · GitHub
[go: up one dir, main page]

Skip to content

Commit df3ee1a

Browse files
author
Erlend Egeberg Aasland
authored
Sync section 25.7 with Python/compile.c (python#672)
1 parent 6343869 commit df3ee1a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

compiler.rst

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ Emission of bytecode is handled by the following macros:
367367

368368
``ADDOP(struct compiler *, int)``
369369
add a specified opcode
370+
``ADDOP_NOLINE(struct compiler *, int)``
371+
like ``ADDOP`` without a line number; used for artificial opcodes without
372+
no corresponding token in the source code
373+
``ADDOP_IN_SCOPE(struct compiler *, int)``
374+
like ``ADDOP``, but also exits current scope; used for adding return value
375+
opcodes in lambdas and closures
370376
``ADDOP_I(struct compiler *, int, Py_ssize_t)``
371377
add an opcode that takes an integer argument
372378
``ADDOP_O(struct compiler *, int, PyObject *, TYPE)``
@@ -387,10 +393,14 @@ Emission of bytecode is handled by the following macros:
387393
position of the specified PyObject in the consts table.
388394
``ADDOP_LOAD_CONST_NEW(struct compiler *, PyObject *)``
389395
just like ``ADDOP_LOAD_CONST_NEW``, but steals a reference to PyObject
390-
``ADDOP_JABS(struct compiler *, int, basicblock *)``
391-
create an absolute jump to a basic block
392-
``ADDOP_JREL(struct compiler *, int, basicblock *)``
393-
create a relative jump to a basic block
396+
``ADDOP_JUMP(struct compiler *, int, basicblock *)``
397+
create a jump to a basic block
398+
``ADDOP_JUMP_NOLINE(struct compiler *, int, basicblock *)``
399+
like ``ADDOP_JUMP`` without a line number; used for artificial jumps
400+
without no corresponding token in the source code.
401+
``ADDOP_JUMP_COMPARE(struct compiler *, cmpop_ty)``
402+
depending on the second argument, add an ``ADDOP_I`` with either an
403+
``IS_OP``, ``CONTAINS_OP``, or ``COMPARE_OP`` opcode.
394404

395405
Several helper functions that will emit bytecode and are named
396406
:samp:`compiler_{xx}()` where *xx* is what the function helps with (``list``,

0 commit comments

Comments
 (0)
0