diff options
author | Mark Shannon <mark@hotpy.org> | 2024-08-23 09:22:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-23 09:22:35 (GMT) |
commit | 5d3201fe3f76aeba33e9e5956ba80a116e422bd0 (patch) | |
tree | 5a8abea53010c9412558274a88ccb9226171b007 /Python/generated_cases.c.h | |
parent | 90b6d0e0f8f07d7443695e14a18488cb499d3b4d (diff) | |
download | cpython-5d3201fe3f76aeba33e9e5956ba80a116e422bd0.zip cpython-5d3201fe3f76aeba33e9e5956ba80a116e422bd0.tar.gz cpython-5d3201fe3f76aeba33e9e5956ba80a116e422bd0.tar.bz2 |
GH-123040: Specialize shadowed `LOAD_ATTR`. (GH-123219)
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r-- | Python/generated_cases.c.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 181940d..feb16cc 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -4937,6 +4937,47 @@ DISPATCH(); } + TARGET(LOAD_ATTR_CLASS_WITH_METACLASS_CHECK) { + _Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr; + next_instr += 10; + INSTRUCTION_STATS(LOAD_ATTR_CLASS_WITH_METACLASS_CHECK); + static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size"); + _PyStackRef owner; + _PyStackRef attr; + _PyStackRef null = PyStackRef_NULL; + /* Skip 1 cache entry */ + // _CHECK_ATTR_CLASS + owner = stack_pointer[-1]; + { + uint32_t type_version = read_u32(&this_instr[2].cache); + PyObject *owner_o = PyStackRef_AsPyObjectBorrow(owner); + DEOPT_IF(!PyType_Check(owner_o), LOAD_ATTR); + assert(type_version != 0); + DEOPT_IF(((PyTypeObject *)owner_o)->tp_version_tag != type_version, LOAD_ATTR); + } + // _GUARD_TYPE_VERSION + { + uint32_t type_version = read_u32(&this_instr[4].cache); + PyTypeObject *tp = Py_TYPE(PyStackRef_AsPyObjectBorrow(owner)); + assert(type_version != 0); + DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); + } + // _LOAD_ATTR_CLASS + { + PyObject *descr = read_obj(&this_instr[6].cache); + STAT_INC(LOAD_ATTR, hit); + assert(descr != NULL); + attr = PyStackRef_FromPyObjectNew(descr); + stack_pointer[-1] = attr; + null = PyStackRef_NULL; + PyStackRef_CLOSE(owner); + } + if (oparg & 1) stack_pointer[0] = null; + stack_pointer += (oparg & 1); + assert(WITHIN_STACK_BOUNDS()); + DISPATCH(); + } + TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { _Py_CODEUNIT *this_instr = frame->instr_ptr = next_instr; next_instr += 10; |