Skip to content

Commit 8f52910

Browse files
committed
STORE_ATTR_INSTANCE_VALUE
1 parent 4f1c647 commit 8f52910

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

Python/bytecodes.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ 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;
88+
static _Py_CODEUNIT when_to_jump_mask, invert, counter, index;
89+
static uint32_t type_version;
8990
// Dummy opcode names for 'op' opcodes
9091
#define _BINARY_OP_INPLACE_ADD_UNICODE_PART_1 1001
9192
#define _BINARY_OP_INPLACE_ADD_UNICODE_PART_2 1002
@@ -1944,22 +1945,15 @@ dummy_func(
19441945
DISPATCH_INLINED(new_frame);
19451946
}
19461947

1947-
// stack effect: (__0, __1 -- )
1948-
inst(STORE_ATTR_INSTANCE_VALUE) {
1948+
inst(STORE_ATTR_INSTANCE_VALUE, (unused/1, type_version/2, index/1, value, owner --)) {
19491949
assert(cframe.use_tracing == 0);
1950-
PyObject *owner = TOP();
19511950
PyTypeObject *tp = Py_TYPE(owner);
1952-
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
1953-
uint32_t type_version = read_u32(cache->version);
19541951
assert(type_version != 0);
19551952
DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR);
19561953
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
19571954
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
19581955
DEOPT_IF(!_PyDictOrValues_IsValues(dorv), STORE_ATTR);
19591956
STAT_INC(STORE_ATTR, hit);
1960-
Py_ssize_t index = cache->index;
1961-
STACK_SHRINK(1);
1962-
PyObject *value = POP();
19631957
PyDictValues *values = _PyDictOrValues_GetValues(dorv);
19641958
PyObject *old_value = values->values[index];
19651959
values->values[index] = value;
@@ -1970,7 +1964,6 @@ dummy_func(
19701964
Py_DECREF(old_value);
19711965
}
19721966
Py_DECREF(owner);
1973-
JUMPBY(INLINE_CACHE_ENTRIES_STORE_ATTR);
19741967
}
19751968

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

Python/generated_cases.c.h

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

0 commit comments

Comments
 (0)