diff options
author | Mark Shannon <mark@hotpy.org> | 2025-01-27 16:24:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-27 16:24:48 (GMT) |
commit | 75b49621578a45415bfeedd6cc68d50e821d8281 (patch) | |
tree | 907f5c0765dc65e5f0eaa81ef9f80589623e0361 /Python/optimizer_analysis.c | |
parent | 8ec76d90340287eb3587f0ae388bbfe158fb28d8 (diff) | |
download | cpython-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_analysis.c')
-rw-r--r-- | Python/optimizer_analysis.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c index b9ac30e..5dd7725 100644 --- a/Python/optimizer_analysis.c +++ b/Python/optimizer_analysis.c @@ -109,10 +109,14 @@ convert_global_to_const(_PyUOpInstruction *inst, PyObject *obj) return NULL; } if (_Py_IsImmortal(res)) { - inst->opcode = (inst->oparg & 1) ? _LOAD_CONST_INLINE_BORROW_WITH_NULL : _LOAD_CONST_INLINE_BORROW; + inst->opcode = _LOAD_CONST_INLINE_BORROW; } else { - inst->opcode = (inst->oparg & 1) ? _LOAD_CONST_INLINE_WITH_NULL : _LOAD_CONST_INLINE; + inst->opcode = _LOAD_CONST_INLINE; + } + if (inst->oparg & 1) { + assert(inst[1].opcode == _PUSH_NULL_CONDITIONAL); + assert(inst[1].oparg & 1); } inst->operand0 = (uint64_t)res; return res; |