GH-115651: Convert LOAD_MODULE_ATTR into LOAD_INLINE_CONST when the module is itself a constant. (GH-115711)

This commit is contained in:
Mark Shannon 2024-02-22 14:48:25 +00:00 committed by GitHub
parent c6a47de709
commit b348313e7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 182 additions and 95 deletions

View file

@ -1856,11 +1856,11 @@
case _CHECK_ATTR_MODULE: {
PyObject *owner;
owner = stack_pointer[-1];
uint32_t type_version = (uint32_t)CURRENT_OPERAND();
uint32_t dict_version = (uint32_t)CURRENT_OPERAND();
if (!PyModule_CheckExact(owner)) goto deoptimize;
PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict;
assert(dict != NULL);
if (dict->ma_keys->dk_version != type_version) goto deoptimize;
if (dict->ma_keys->dk_version != dict_version) goto deoptimize;
break;
}