aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/optimizer.c
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2025-01-23 04:26:25 -0500
committerGitHub <noreply@github.com>2025-01-23 09:26:25 +0000
commita10f99375e7912df863cf101a38e9703cfcd72f1 (patch)
tree7909c7896fe256427c1149d2416fb7912ad3ba48 /Python/optimizer.c
parentd7d066c3ab6842117f9e0fb1c9dde4bce00fa1e3 (diff)
downloadcpython-a10f99375e7912df863cf101a38e9703cfcd72f1.tar.gz
cpython-a10f99375e7912df863cf101a38e9703cfcd72f1.zip
Revert "GH-128914: Remove conditional stack effects from `bytecodes.c` and the code generators (GH-128918)" (GH-129202)
The commit introduced a ~2.5-3% regression in the free threading build. This reverts commit ab61d3f4303d14a413bc9ae6557c730ffdf7579e.
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r--Python/optimizer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c
index b91caf11ffa..9beb47246eb 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -1274,7 +1274,10 @@ uop_optimize(
for (int pc = 0; pc < length; pc++) {
int opcode = buffer[pc].opcode;
int oparg = buffer[pc].oparg;
- if (oparg < _PyUop_Replication[opcode]) {
+ if (_PyUop_Flags[opcode] & HAS_OPARG_AND_1_FLAG) {
+ buffer[pc].opcode = opcode + 1 + (oparg & 1);
+ }
+ else if (oparg < _PyUop_Replication[opcode]) {
buffer[pc].opcode = opcode + oparg + 1;
}
else if (is_terminator(&buffer[pc])) {