Skip to content

Commit fb1d227

Browse files
committed
Move length checks to JIT
1 parent cdbe2e6 commit fb1d227

File tree

5 files changed

+4
-28
lines changed

5 files changed

+4
-28
lines changed

Include/internal/pycore_uop_metadata.h

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

Python/bytecodes.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,10 +1660,7 @@ dummy_func(
16601660
}
16611661

16621662
op(_UNPACK_SEQUENCE_UNIQUE_TWO_TUPLE, (seq -- val1, val0)) {
1663-
assert(oparg == 2);
16641663
PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq);
1665-
assert(PyTuple_CheckExact(seq_o));
1666-
DEOPT_IF(PyTuple_GET_SIZE(seq_o) != 2);
16671664
STAT_INC(UNPACK_SEQUENCE, hit);
16681665
val0 = PyStackRef_FromPyObjectSteal(PyTuple_GET_ITEM(seq_o, 0));
16691666
val1 = PyStackRef_FromPyObjectSteal(PyTuple_GET_ITEM(seq_o, 1));
@@ -1672,10 +1669,7 @@ dummy_func(
16721669
}
16731670

16741671
op(_UNPACK_SEQUENCE_UNIQUE_THREE_TUPLE, (seq -- val2, val1, val0)) {
1675-
assert(oparg == 3);
16761672
PyObject *seq_o = PyStackRef_AsPyObjectSteal(seq);
1677-
assert(PyTuple_CheckExact(seq_o));
1678-
DEOPT_IF(PyTuple_GET_SIZE(seq_o) != 3);
16791673
STAT_INC(UNPACK_SEQUENCE, hit);
16801674
val0 = PyStackRef_FromPyObjectSteal(PyTuple_GET_ITEM(seq_o, 0));
16811675
val1 = PyStackRef_FromPyObjectSteal(PyTuple_GET_ITEM(seq_o, 1));

Python/executor_cases.c.h

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

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ dummy_func(void) {
13121312
}
13131313

13141314
op(_UNPACK_SEQUENCE_TWO_TUPLE, (seq -- val1, val0)) {
1315-
if (PyJitRef_IsUnique(seq)) {
1315+
if (PyJitRef_IsUnique(seq) && sym_tuple_length(seq) == 2) {
13161316
ADD_OP(_UNPACK_SEQUENCE_UNIQUE_TWO_TUPLE, oparg, 0);
13171317
}
13181318
val0 = sym_tuple_getitem(ctx, seq, 0);

Python/optimizer_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)