Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Include/internal/pycore_uop_ids.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Include/internal/pycore_uop_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Lib/test/test_capi/test_opt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2470,6 +2470,23 @@ def testfunc(n):
self.assertNotIn("_GUARD_TOS_INT", uops)
self.assertNotIn("_GUARD_NOS_INT", uops)

def test_store_subscr_int(self):
def testfunc(n):
l = [0, 0, 0, 0]
for _ in range(n):
l[0] = 1
l[1] = 2
l[2] = 3
l[3] = 4
return sum(l)

res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
self.assertEqual(res, 10)
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertIn("_POP_TOP_INT", uops)
self.assertNotIn("_POP_TOP_NOP", uops)
Comment thread
corona10 marked this conversation as resolved.
Outdated

def test_attr_promotion_failure(self):
# We're not testing for any specific uops here, just
# testing it doesn't crash.
Expand Down
10 changes: 5 additions & 5 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1126,9 +1126,9 @@ dummy_func(
macro(STORE_SUBSCR) = _SPECIALIZE_STORE_SUBSCR + _STORE_SUBSCR;

macro(STORE_SUBSCR_LIST_INT) =
_GUARD_TOS_INT + _GUARD_NOS_LIST + unused/1 + _STORE_SUBSCR_LIST_INT;
_GUARD_TOS_INT + _GUARD_NOS_LIST + unused/1 + _STORE_SUBSCR_LIST_INT + POP_TOP + _POP_TOP_INT;

op(_STORE_SUBSCR_LIST_INT, (value, list_st, sub_st -- )) {
op(_STORE_SUBSCR_LIST_INT, (value, list_st, sub_st -- ss, ls)) {
Comment thread
corona10 marked this conversation as resolved.
Outdated
PyObject *sub = PyStackRef_AsPyObjectBorrow(sub_st);
PyObject *list = PyStackRef_AsPyObjectBorrow(list_st);

Expand All @@ -1151,9 +1151,9 @@ dummy_func(
PyStackRef_AsPyObjectSteal(value));
assert(old_value != NULL);
UNLOCK_OBJECT(list); // unlock before decrefs!
PyStackRef_CLOSE_SPECIALIZED(sub_st, _PyLong_ExactDealloc);
DEAD(sub_st);
PyStackRef_CLOSE(list_st);
INPUTS_DEAD();
ss = sub_st;
ls = list_st;
Py_DECREF(old_value);
}

Expand Down
20 changes: 14 additions & 6 deletions Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading