Skip to content

Commit d24cc5a

Browse files
committed
STORE_ATTR_SLOT, and complete the store_attr family
1 parent 539f887 commit d24cc5a

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

Python/bytecodes.c

+9-12
Original file line numberDiff line numberDiff line change
@@ -1127,6 +1127,13 @@ dummy_func(
11271127
Py_DECREF(seq);
11281128
}
11291129

1130+
family(store_attr) = {
1131+
STORE_ATTR,
1132+
STORE_ATTR_INSTANCE_VALUE,
1133+
STORE_ATTR_SLOT,
1134+
STORE_ATTR_WITH_HINT,
1135+
};
1136+
11301137
inst(STORE_ATTR, (counter/1, v, owner, unused/3 --)) {
11311138
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
11321139
assert(cframe.use_tracing == 0);
@@ -2008,24 +2015,17 @@ dummy_func(
20082015
Py_DECREF(owner);
20092016
}
20102017

2011-
// stack effect: (__0, __1 -- )
2012-
inst(STORE_ATTR_SLOT) {
2018+
inst(STORE_ATTR_SLOT, (unused/1, type_version/2, index/1, value, owner --)) {
20132019
assert(cframe.use_tracing == 0);
2014-
PyObject *owner = TOP();
20152020
PyTypeObject *tp = Py_TYPE(owner);
2016-
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
2017-
uint32_t type_version = read_u32(cache->version);
20182021
assert(type_version != 0);
20192022
DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR);
2020-
char *addr = (char *)owner + cache->index;
2023+
char *addr = (char *)owner + index;
20212024
STAT_INC(STORE_ATTR, hit);
2022-
STACK_SHRINK(1);
2023-
PyObject *value = POP();
20242025
PyObject *old_value = *(PyObject **)addr;
20252026
*(PyObject **)addr = value;
20262027
Py_XDECREF(old_value);
20272028
Py_DECREF(owner);
2028-
JUMPBY(INLINE_CACHE_ENTRIES_STORE_ATTR);
20292029
}
20302030

20312031
family(compare_op) = {
@@ -3654,9 +3654,6 @@ family(load_fast) = { LOAD_FAST, LOAD_FAST__LOAD_CONST, LOAD_FAST__LOAD_FAST };
36543654
family(load_global) = {
36553655
LOAD_GLOBAL, LOAD_GLOBAL_BUILTIN,
36563656
LOAD_GLOBAL_MODULE };
3657-
family(store_attr) = {
3658-
STORE_ATTR, STORE_ATTR_INSTANCE_VALUE,
3659-
STORE_ATTR_SLOT, STORE_ATTR_WITH_HINT };
36603657
family(store_fast) = { STORE_FAST, STORE_FAST__LOAD_FAST, STORE_FAST__STORE_FAST };
36613658
family(store_subscr) = {
36623659
STORE_SUBSCR, STORE_SUBSCR_DICT,

Python/generated_cases.c.h

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)