Skip to content

Commit 539f887

Browse files
committed
STORE_ATTR_WITH_HINT
1 parent 8f52910 commit 539f887

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

Python/bytecodes.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static PyObject *list, *tuple, *dict, *owner;
8585
static PyObject *exit_func, *lasti, *val;
8686
static size_t jump;
8787
// Dummy variables for cache effects
88-
static _Py_CODEUNIT when_to_jump_mask, invert, counter, index;
88+
static _Py_CODEUNIT when_to_jump_mask, invert, counter, index, hint;
8989
static uint32_t type_version;
9090
// Dummy opcode names for 'op' opcodes
9191
#define _BINARY_OP_INPLACE_ADD_UNICODE_PART_1 1001
@@ -1966,13 +1966,9 @@ dummy_func(
19661966
Py_DECREF(owner);
19671967
}
19681968

1969-
// stack effect: (__0, __1 -- )
1970-
inst(STORE_ATTR_WITH_HINT) {
1969+
inst(STORE_ATTR_WITH_HINT, (unused/1, type_version/2, hint/1, value, owner --)) {
19711970
assert(cframe.use_tracing == 0);
1972-
PyObject *owner = TOP();
19731971
PyTypeObject *tp = Py_TYPE(owner);
1974-
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
1975-
uint32_t type_version = read_u32(cache->version);
19761972
assert(type_version != 0);
19771973
DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR);
19781974
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
@@ -1982,17 +1978,14 @@ dummy_func(
19821978
DEOPT_IF(dict == NULL, STORE_ATTR);
19831979
assert(PyDict_CheckExact((PyObject *)dict));
19841980
PyObject *name = GETITEM(names, oparg);
1985-
uint16_t hint = cache->index;
19861981
DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, STORE_ATTR);
1987-
PyObject *value, *old_value;
1982+
PyObject *old_value;
19881983
uint64_t new_version;
19891984
if (DK_IS_UNICODE(dict->ma_keys)) {
19901985
PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(dict->ma_keys) + hint;
19911986
DEOPT_IF(ep->me_key != name, STORE_ATTR);
19921987
old_value = ep->me_value;
19931988
DEOPT_IF(old_value == NULL, STORE_ATTR);
1994-
STACK_SHRINK(1);
1995-
value = POP();
19961989
new_version = _PyDict_NotifyEvent(PyDict_EVENT_MODIFIED, dict, name, value);
19971990
ep->me_value = value;
19981991
}
@@ -2001,8 +1994,6 @@ dummy_func(
20011994
DEOPT_IF(ep->me_key != name, STORE_ATTR);
20021995
old_value = ep->me_value;
20031996
DEOPT_IF(old_value == NULL, STORE_ATTR);
2004-
STACK_SHRINK(1);
2005-
value = POP();
20061997
new_version = _PyDict_NotifyEvent(PyDict_EVENT_MODIFIED, dict, name, value);
20071998
ep->me_value = value;
20081999
}
@@ -2015,7 +2006,6 @@ dummy_func(
20152006
/* PEP 509 */
20162007
dict->ma_version_tag = new_version;
20172008
Py_DECREF(owner);
2018-
JUMPBY(INLINE_CACHE_ENTRIES_STORE_ATTR);
20192009
}
20202010

20212011
// stack effect: (__0, __1 -- )

Python/generated_cases.c.h

Lines changed: 7 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)