Skip to content

Commit 7bdddb0

Browse files
committed
Split STORE_ATTR_INSTANCE_VALUE
1 parent 5d0fa92 commit 7bdddb0

File tree

5 files changed

+127
-52
lines changed

5 files changed

+127
-52
lines changed

Include/internal/pycore_opcode_metadata.h

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

Python/abstract_interp_cases.c.h

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

Python/bytecodes.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2022,13 +2022,15 @@ dummy_func(
20222022
DISPATCH_INLINED(new_frame);
20232023
}
20242024

2025-
inst(STORE_ATTR_INSTANCE_VALUE, (unused/1, type_version/2, index/1, value, owner --)) {
2025+
op(_GUARD_DORV_VALUES, (owner -- owner)) {
20262026
PyTypeObject *tp = Py_TYPE(owner);
2027-
assert(type_version != 0);
2028-
DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR);
20292027
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
20302028
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
2031-
DEOPT_IF(!_PyDictOrValues_IsValues(dorv), STORE_ATTR);
2029+
DEOPT_IF(!_PyDictOrValues_IsValues(dorv), LOAD_ATTR);
2030+
}
2031+
2032+
op(_STORE_ATTR_INSTANCE_VALUE, (index/1, value, owner --)) {
2033+
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
20322034
STAT_INC(STORE_ATTR, hit);
20332035
PyDictValues *values = _PyDictOrValues_GetValues(dorv);
20342036
PyObject *old_value = values->values[index];
@@ -2042,6 +2044,12 @@ dummy_func(
20422044
Py_DECREF(owner);
20432045
}
20442046

2047+
macro(STORE_ATTR_INSTANCE_VALUE) =
2048+
unused/1 +
2049+
_GUARD_TYPE_VERSION_STORE +
2050+
_GUARD_DORV_VALUES +
2051+
_STORE_ATTR_INSTANCE_VALUE;
2052+
20452053
inst(STORE_ATTR_WITH_HINT, (unused/1, type_version/2, hint/1, value, owner --)) {
20462054
PyTypeObject *tp = Py_TYPE(owner);
20472055
assert(type_version != 0);

Python/executor_cases.c.h

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

Python/generated_cases.c.h

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

0 commit comments

Comments
 (0)