mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-26219: per opcode cache for LOAD_GLOBAL (GH-12884)
This patch implements per opcode cache mechanism, and use it in only LOAD_GLOBAL opcode. Based on Yury's opcache3.patch in bpo-26219.
This commit is contained in:
parent
29ec422810
commit
91234a1636
13 changed files with 285 additions and 16 deletions
|
|
@ -1080,20 +1080,21 @@ insertdict(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject *value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (_PyDict_HasSplitTable(mp)) {
|
||||
mp->ma_values[ix] = value;
|
||||
if (old_value == NULL) {
|
||||
/* pending state */
|
||||
assert(ix == mp->ma_used);
|
||||
mp->ma_used++;
|
||||
if (old_value != value) {
|
||||
if (_PyDict_HasSplitTable(mp)) {
|
||||
mp->ma_values[ix] = value;
|
||||
if (old_value == NULL) {
|
||||
/* pending state */
|
||||
assert(ix == mp->ma_used);
|
||||
mp->ma_used++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert(old_value != NULL);
|
||||
DK_ENTRIES(mp->ma_keys)[ix].me_value = value;
|
||||
}
|
||||
mp->ma_version_tag = DICT_NEXT_VERSION();
|
||||
}
|
||||
else {
|
||||
assert(old_value != NULL);
|
||||
DK_ENTRIES(mp->ma_keys)[ix].me_value = value;
|
||||
}
|
||||
|
||||
mp->ma_version_tag = DICT_NEXT_VERSION();
|
||||
Py_XDECREF(old_value); /* which **CAN** re-enter (see issue #22653) */
|
||||
ASSERT_CONSISTENT(mp);
|
||||
Py_DECREF(key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue