diff options
author | Mark Shannon <mark@hotpy.org> | 2024-01-15 11:41:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-15 11:41:06 +0000 |
commit | ac10947ba79a15bfdaa3ca92c6864214648ab364 (patch) | |
tree | 1853aea09cbd74fdaf1d4d3b999ba250f43ff6ae /Python/optimizer.c | |
parent | 2010d45327128594aed332befa687c8aead010bc (diff) | |
download | cpython-ac10947ba79a15bfdaa3ca92c6864214648ab364.tar.gz cpython-ac10947ba79a15bfdaa3ca92c6864214648ab364.zip |
GH-112354: `_GUARD_IS_TRUE_POP` side-exits to target the next instruction, not themselves. (GH-114078)
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r-- | Python/optimizer.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c index 236ae266971..1551a5ef61f 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -481,18 +481,19 @@ top: // Jump here after _PUSH_FRAME or likely branches goto done; } uint32_t uopcode = BRANCH_TO_GUARD[opcode - POP_JUMP_IF_FALSE][jump_likely]; - _Py_CODEUNIT *next_instr = instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]]; DPRINTF(2, "%s(%d): counter=%x, bitcount=%d, likely=%d, confidence=%d, uopcode=%s\n", _PyOpcode_OpName[opcode], oparg, counter, bitcount, jump_likely, confidence, _PyUOpName(uopcode)); - ADD_TO_TRACE(uopcode, max_length, 0, target); + _Py_CODEUNIT *next_instr = instr + 1 + _PyOpcode_Caches[_PyOpcode_Deopt[opcode]]; + _Py_CODEUNIT *target_instr = next_instr + oparg; if (jump_likely) { - _Py_CODEUNIT *target_instr = next_instr + oparg; DPRINTF(2, "Jump likely (%x = %d bits), continue at byte offset %d\n", instr[1].cache, bitcount, 2 * INSTR_IP(target_instr, code)); instr = target_instr; + ADD_TO_TRACE(uopcode, max_length, 0, INSTR_IP(next_instr, code)); goto top; } + ADD_TO_TRACE(uopcode, max_length, 0, INSTR_IP(target_instr, code)); break; } |