mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
bpo-45885: Don't un-adapt COMPARE_OP
when collecting stats (GH-31516)
This commit is contained in:
parent
424023efee
commit
375a56bd40
2 changed files with 9 additions and 2 deletions
|
@ -0,0 +1 @@
|
||||||
|
Don't un-adapt :opcode:`COMPARE_OP` when collecting specialization stats.
|
|
@ -2013,9 +2013,15 @@ _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs,
|
||||||
int op = adaptive->original_oparg;
|
int op = adaptive->original_oparg;
|
||||||
int next_opcode = _Py_OPCODE(instr[1]);
|
int next_opcode = _Py_OPCODE(instr[1]);
|
||||||
if (next_opcode != POP_JUMP_IF_FALSE && next_opcode != POP_JUMP_IF_TRUE) {
|
if (next_opcode != POP_JUMP_IF_FALSE && next_opcode != POP_JUMP_IF_TRUE) {
|
||||||
// Can't ever combine, so don't don't bother being adaptive.
|
// Can't ever combine, so don't don't bother being adaptive (unless
|
||||||
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_OP_NOT_FOLLOWED_BY_COND_JUMP);
|
// we're collecting stats, where it's more important to get accurate hit
|
||||||
|
// counts for the unadaptive version and each of the different failure
|
||||||
|
// types):
|
||||||
|
#ifndef Py_STATS
|
||||||
*instr = _Py_MAKECODEUNIT(COMPARE_OP, adaptive->original_oparg);
|
*instr = _Py_MAKECODEUNIT(COMPARE_OP, adaptive->original_oparg);
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
SPECIALIZATION_FAIL(COMPARE_OP, SPEC_FAIL_COMPARE_OP_NOT_FOLLOWED_BY_COND_JUMP);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
assert(op <= Py_GE);
|
assert(op <= Py_GE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue