mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Shrink the LOAD_METHOD cache by one codeunit. (#93537)
This commit is contained in:
parent
75ceae05c1
commit
f012df706c
8 changed files with 12 additions and 18 deletions
|
@ -4581,12 +4581,9 @@ handle_eval_breaker:
|
|||
DEOPT_IF(self_cls->tp_version_tag != read_u32(cache->type_version),
|
||||
LOAD_METHOD);
|
||||
/* Treat index as a signed 16 bit value */
|
||||
int dictoffset = *(int16_t *)&cache->dict_offset;
|
||||
int dictoffset = self_cls->tp_dictoffset;
|
||||
assert(dictoffset > 0);
|
||||
PyDictObject **dictptr = (PyDictObject**)(((char *)self)+dictoffset);
|
||||
assert(
|
||||
dictoffset == MANAGED_DICT_OFFSET ||
|
||||
(dictoffset == self_cls->tp_dictoffset && dictoffset > 0)
|
||||
);
|
||||
PyDictObject *dict = *dictptr;
|
||||
DEOPT_IF(dict == NULL, LOAD_METHOD);
|
||||
DEOPT_IF(dict->ma_keys->dk_version != read_u32(cache->keys_version),
|
||||
|
@ -4628,9 +4625,9 @@ handle_eval_breaker:
|
|||
_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;
|
||||
int dictoffset = self_cls->tp_dictoffset;
|
||||
assert(dictoffset > 0);
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue