diff options
author | Mark Shannon <mark@hotpy.org> | 2022-06-07 09:28:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-07 09:28:53 (GMT) |
commit | f012df706cf3a9e63625b8166fe3f419855e9a94 (patch) | |
tree | 79e77365bf7a0deda813c0036ee0ed3bde2390c5 /Python/ceval.c | |
parent | 75ceae05c11461beda65e6170b67b0b42fd55cd0 (diff) | |
download | cpython-f012df706cf3a9e63625b8166fe3f419855e9a94.zip cpython-f012df706cf3a9e63625b8166fe3f419855e9a94.tar.gz cpython-f012df706cf3a9e63625b8166fe3f419855e9a94.tar.bz2 |
Shrink the LOAD_METHOD cache by one codeunit. (#93537)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index ec86c70..d1480ac 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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); |