8000 GH-89987: Shrink the `BINARY_SUBSCR` caches by brandtbucher · Pull Request #103022 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-89987: Shrink the BINARY_SUBSCR caches #103022

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 6 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Minor cleanup
  • Loading branch information
brandtbucher committed Mar 24, 2023
commit 8c85b34379c41d7037821ac5a834c1c03ce11fdc
6 changes: 3 additions & 3 deletions Lib/importlib/_bootstrap_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,9 @@ def _write_atomic(path, data, mode=0o666):
# Python 3.12a6 3519 (Modify SEND instruction)
# Python 3.12a6 3520 (Remove PREP_RERAISE_STAR, add CALL_INTRINSIC_2)
# Python 3.12a7 3521 (Shrink the LOAD_GLOBAL caches)
# Python 3.12a7 3522 (Removed JUMP_IF_FALSE_OR_POP/JUMP_IF_TRUE_OR_POP)
# Python 3.12a7 3523 (Convert COMPARE_AND_BRANCH back to COMPARE_OP)

# Python 3.12a7 3525 (Shrink the BINARY_SUBSCR caches)
# Python 3.12a7 3524 (Shrink the BINARY_SUBSCR caches)

# Python 3.13 will start with 3550

Expand All @@ -454,7 +454,7 @@ def _write_atomic(path, data, mode=0o666):
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
# in PC/launcher.c must also be updated.

MAGIC_NUMBER = (3525).to_bytes(2, 'little') + b'\r\n'
MAGIC_NUMBER = (3524).to_bytes(2, 'little') + b'\r\n'

_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c

Expand Down
7 changes: 1 addition & 6 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1336,13 +1336,8 @@ _Py_Specialize_BinarySubscr(
goto fail;
}
PyHeapTypeObject *ht = (PyHeapTypeObject *)container_type;
if (ht->_spec_cache.getitem == NULL) {
ht->_spec_cache.getitem = descriptor;
ht->_spec_cache.getitem_version = version;
}
assert(ht->_spec_cache.getitem == descriptor &&
ht->_spec_cache.getitem_version == version);
ht->_spec_cache.getitem = descriptor;
ht->_spec_cache.getitem_version = version;
instr->op.code = BINARY_SUBSCR_GETITEM;
goto success;
}
Expand Down
0