diff options
| author | Mark Shannon <mark@hotpy.org> | 2024-01-24 12:08:31 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-24 12:08:31 (GMT) |
| commit | 384429d1c0cf011dcf88d4043e0328de8b063c24 (patch) | |
| tree | d3b325f08d9359bce60065b162ddec3572b08662 /Python/optimizer.c | |
| parent | 1e4f00ebd8db44a031b61eed0803b4c3d731aed7 (diff) | |
| download | cpython-384429d1c0cf011dcf88d4043e0328de8b063c24.zip cpython-384429d1c0cf011dcf88d4043e0328de8b063c24.tar.gz cpython-384429d1c0cf011dcf88d4043e0328de8b063c24.tar.bz2 | |
GH-113710: Add a tier 2 peephole optimization pass. (GH-114487)
* Convert _LOAD_CONST to inline versions
* Remove PEP 523 checks
Diffstat (limited to 'Python/optimizer.c')
| -rw-r--r-- | Python/optimizer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c index 1551a5e..4b6ed17 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -588,6 +588,9 @@ top: // Jump here after _PUSH_FRAME or likely branches ADD_TO_TRACE(uop, oparg, operand, target); if (uop == _POP_FRAME) { TRACE_STACK_POP(); + /* Set the operand to the code object returned to, + * to assist optimization passes */ + trace[trace_length-1].operand = (uintptr_t)code; DPRINTF(2, "Returning to %s (%s:%d) at byte offset %d\n", PyUnicode_AsUTF8(code->co_qualname), @@ -629,6 +632,9 @@ top: // Jump here after _PUSH_FRAME or likely branches instr += _PyOpcode_Caches[_PyOpcode_Deopt[opcode]] + 1; TRACE_STACK_PUSH(); _Py_BloomFilter_Add(dependencies, new_code); + /* Set the operand to the callee's code object, + * to assist optimization passes */ + trace[trace_length-1].operand = (uintptr_t)new_code; code = new_code; instr = _PyCode_CODE(code); DPRINTF(2, |
