diff options
| author | Mark Shannon <mark@hotpy.org> | 2024-03-05 15:23:08 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-05 15:23:08 (GMT) |
| commit | 23db9c62272f7470aadf8f52fe3ebb42b5e5d380 (patch) | |
| tree | d3794d721c4e97f691fa0c5bed595f219075f4b7 /Python/generated_cases.c.h | |
| parent | 0c81ce13602b88fd59f23f701ed8dc377d74e76e (diff) | |
| download | cpython-23db9c62272f7470aadf8f52fe3ebb42b5e5d380.zip cpython-23db9c62272f7470aadf8f52fe3ebb42b5e5d380.tar.gz cpython-23db9c62272f7470aadf8f52fe3ebb42b5e5d380.tar.bz2 | |
GH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)
Diffstat (limited to 'Python/generated_cases.c.h')
| -rw-r--r-- | Python/generated_cases.c.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index e612c9e..4947c91 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -5580,17 +5580,24 @@ next_instr += 4; INSTRUCTION_STATS(TO_BOOL_ALWAYS_TRUE); static_assert(INLINE_CACHE_ENTRIES_TO_BOOL == 3, "incorrect cache size"); + PyObject *owner; PyObject *value; PyObject *res; /* Skip 1 cache entry */ - value = stack_pointer[-1]; - uint32_t version = read_u32(&this_instr[2].cache); - // This one is a bit weird, because we expect *some* failures: - assert(version); - DEOPT_IF(Py_TYPE(value)->tp_version_tag != version, TO_BOOL); - STAT_INC(TO_BOOL, hit); - Py_DECREF(value); - res = Py_True; + // _GUARD_TYPE_VERSION + owner = stack_pointer[-1]; + { + uint32_t type_version = read_u32(&this_instr[2].cache); + PyTypeObject *tp = Py_TYPE(owner); + assert(type_version != 0); + DEOPT_IF(tp->tp_version_tag != type_version, TO_BOOL); + } + // _REPLACE_WITH_TRUE + value = owner; + { + Py_DECREF(value); + res = Py_True; + } stack_pointer[-1] = res; DISPATCH(); } |
