mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
gh-92777: Add LOAD_METHOD_LAZY_DICT (GH-92778)
This commit is contained in:
parent
db3ef0c82a
commit
5e6e5b98a8
7 changed files with 85 additions and 49 deletions
|
@ -4673,6 +4673,29 @@ handle_eval_breaker:
|
|||
NOTRACE_DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(LOAD_METHOD_LAZY_DICT) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
PyObject *self = TOP();
|
||||
PyTypeObject *self_cls = Py_TYPE(self);
|
||||
_PyLoadMethodCache *cache = (_PyLoadMethodCache *)next_instr;
|
||||
uint32_t type_version = read_u32(cache->type_version);
|
||||
DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_METHOD);
|
||||
int dictoffset = cache->dict_offset;
|
||||
PyObject *dict = *(PyObject **)((char *)self + dictoffset);
|
||||
assert(dictoffset == self_cls->tp_dictoffset && dictoffset > 0);
|
||||
/* This object has a __dict__, just not yet created */
|
||||
DEOPT_IF(dict != NULL, LOAD_METHOD);
|
||||
STAT_INC(LOAD_METHOD, hit);
|
||||
PyObject *res = read_obj(cache->descr);
|
||||
assert(res != NULL);
|
||||
assert(_PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR));
|
||||
Py_INCREF(res);
|
||||
SET_TOP(res);
|
||||
PUSH(self);
|
||||
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_METHOD);
|
||||
NOTRACE_DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(LOAD_METHOD_MODULE) {
|
||||
/* LOAD_METHOD, for module methods */
|
||||
assert(cframe.use_tracing == 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue