8000 bpo-44338: Port LOAD_GLOBAL to PEP 659 adaptive interpreter by markshannon · Pull Request #26638 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44338: Port LOAD_GLOBAL to PEP 659 adaptive interpreter #26638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 14, 2021
Prev Previous commit
Next Next commit
Check globals version as well as builtins
  • Loading branch information
markshannon committed Jun 10, 2021
commit 704d2170a60096a9784aee0c0ac3d5e36b094035
12 changes: 8 additions & 4 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,16 @@ _Py_Specialize_LoadGlobal(
if (index != (uint16_t)index) {
goto fail;
}
cache1->module_keys_version = _PyDictKeys_GetVersionForCurrentState((PyDictObject *)globals);
uint32_t keys_version = _PyDictKeys_GetVersionForCurrentState((PyDictObject *)builtins);
if (keys_version == 0) {
uint32_t globals_version = _PyDictKeys_GetVersionForCurrentState((PyDictObject *)globals);
if (globals_version == 0) {
goto fail;
}
uint32_t builtins_version = _PyDictKeys_GetVersionForCurrentState((PyDictObject *)builtins);
if (builtins_version == 0) {
goto fail;
}
cache1->builtin_keys_version = keys_version;
cache1->module_keys_version = globals_version;
cache1->builtin_keys_version = builtins_version;
cache0->index = index;
*instr = _Py_MAKECODEUNIT(LOAD_GLOBAL_BUILTIN, _Py_OPARG(*instr));
goto success;
Expand Down
0