]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-109979: Auto-generate the target for DEOPT_IF() (#110193)
authorGuido van Rossum <guido@python.org>
Tue, 3 Oct 2023 17:13:50 +0000 (10:13 -0700)
committerGitHub <noreply@github.com>
Tue, 3 Oct 2023 17:13:50 +0000 (10:13 -0700)
commitd67edcf0b361c9ee0d29ed719562c58a85304cd0
tree06ce9512bc78d2759f55d3495cf3298b387649ea
parentd73501602f863a54c872ce103cd3fa119e38bac9
gh-109979: Auto-generate the target for DEOPT_IF() (#110193)

In Python/bytecodes.c, you now write
```
    DEOPT_IF(condition);
```
The code generator expands this to
```
    DEOPT_IF(condition, opcode);
```
where `opcode` is the name of the unspecialized instruction.
This works inside macro expansions too.

**CAVEAT:** The entire `DEOPT_IF(condition)` statement must be on a single line.
If it isn't, the substitution will fail; an error will be printed by the code generator
and the C compiler will report some errors.
Lib/test/test_generated_cases.py
Python/bytecodes.c
Python/executor_cases.c.h
Python/generated_cases.c.h
Tools/cases_generator/analysis.py
Tools/cases_generator/generate_cases.py
Tools/cases_generator/instructions.py
Tools/cases_generator/stacking.py