summaryrefslogtreecommitdiffstats
path: root/Python/optimizer.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2025-01-27 16:24:48 (GMT)
committerGitHub <noreply@github.com>2025-01-27 16:24:48 (GMT)
commit75b49621578a45415bfeedd6cc68d50e821d8281 (patch)
tree907f5c0765dc65e5f0eaa81ef9f80589623e0361 /Python/optimizer.c
parent8ec76d90340287eb3587f0ae388bbfe158fb28d8 (diff)
downloadcpython-75b49621578a45415bfeedd6cc68d50e821d8281.zip
cpython-75b49621578a45415bfeedd6cc68d50e821d8281.tar.gz
cpython-75b49621578a45415bfeedd6cc68d50e821d8281.tar.bz2
GH-128914: Remove all but one conditional stack effects (GH-129226)
* Remove all 'if (0)' and 'if (1)' conditional stack effects * Use array instead of conditional for BUILD_SLICE args * Refactor LOAD_GLOBAL to use a common conditional uop * Remove conditional stack effects from LOAD_ATTR specializations * Replace conditional stack effects in LOAD_ATTR with a 0 or 1 sized array. * Remove conditional stack effects from CALL_FUNCTION_EX
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r--Python/optimizer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c
index 9beb472..e395084 100644
--- a/Python/optimizer.c
+++ b/Python/optimizer.c
@@ -1276,15 +1276,16 @@ uop_optimize(
int oparg = buffer[pc].oparg;
if (_PyUop_Flags[opcode] & HAS_OPARG_AND_1_FLAG) {
buffer[pc].opcode = opcode + 1 + (oparg & 1);
+ assert(strncmp(_PyOpcode_uop_name[buffer[pc].opcode], _PyOpcode_uop_name[opcode], strlen(_PyOpcode_uop_name[opcode])) == 0);
}
else if (oparg < _PyUop_Replication[opcode]) {
buffer[pc].opcode = opcode + oparg + 1;
+ assert(strncmp(_PyOpcode_uop_name[buffer[pc].opcode], _PyOpcode_uop_name[opcode], strlen(_PyOpcode_uop_name[opcode])) == 0);
}
else if (is_terminator(&buffer[pc])) {
break;
}
assert(_PyOpcode_uop_name[buffer[pc].opcode]);
- assert(strncmp(_PyOpcode_uop_name[buffer[pc].opcode], _PyOpcode_uop_name[opcode], strlen(_PyOpcode_uop_name[opcode])) == 0);
}
OPT_HIST(effective_trace_length(buffer, length), optimized_trace_length_hist);
length = prepare_for_execution(buffer, length);