Skip to content

Commit 825f6e4

Browse files
committed
STORE_ATTR
1 parent 522dc9a commit 825f6e4

File tree

2 files changed

+16
-28
lines changed

2 files changed

+16
-28
lines changed

Python/bytecodes.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ do { \
8181
// Dummy variables for stack effects.
8282
static PyObject *value, *value1, *value2, *left, *right, *res, *sum, *prod, *sub;
8383
static PyObject *container, *start, *stop, *v, *lhs, *rhs;
84-
static PyObject *list, *tuple, *dict;
84+
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;
88+
static _Py_CODEUNIT when_to_jump_mask, invert, counter;
8989
// Dummy opcode names for 'op' opcodes
9090
#define _BINARY_OP_INPLACE_ADD_UNICODE_PART_1 1001
9191
#define _BINARY_OP_INPLACE_ADD_UNICODE_PART_2 1002
@@ -1126,31 +1126,22 @@ dummy_func(
11261126
Py_DECREF(seq);
11271127
}
11281128

1129-
// stack effect: (__0, __1 -- )
1130-
inst(STORE_ATTR) {
1131-
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
1132-
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
1129+
inst(STORE_ATTR, (counter/1, v, owner, unused/3 --)) {
1130+
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
11331131
assert(cframe.use_tracing == 0);
1134-
PyObject *owner = TOP();
11351132
PyObject *name = GETITEM(names, oparg);
11361133
next_instr--;
11371134
_Py_Specialize_StoreAttr(owner, next_instr, name);
11381135
DISPATCH_SAME_OPARG();
11391136
}
11401137
STAT_INC(STORE_ATTR, deferred);
1138+
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
11411139
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
11421140
PyObject *name = GETITEM(names, oparg);
1143-
PyObject *owner = TOP();
1144-
PyObject *v = SECOND();
1145-
int err;
1146-
STACK_SHRINK(2);
1147-
err = PyObject_SetAttr(owner, name, v);
1141+
int err = PyObject_SetAttr(owner, name, v);
11481142
Py_DECREF(v);
11491143
Py_DECREF(owner);
1150-
if (err != 0) {
1151-
goto error;
1152-
}
1153-
JUMPBY(INLINE_CACHE_ENTRIES_STORE_ATTR);
1144+
ERROR_IF(err != 0, error);
11541145
}
11551146

11561147
// stack effect: (__0 -- )

Python/generated_cases.c.h

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

0 commit comments

Comments
 (0)