Skip to content

Commit cd81ce6

Browse files
fix: insert cache entries for SUBSCR tier 2 instructions (#13)
1 parent f9c4484 commit cd81ce6

File tree

8 files changed

+146
-130
lines changed

8 files changed

+146
-130
lines changed

Include/internal/pycore_opcode.h

+23-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/opcode.h

+75-75
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/opcode.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ def pseudo_op(name, op, real_ops):
298298
"BINARY_SUBSCR_GETITEM",
299299
"BINARY_SUBSCR_LIST_INT",
300300
"BINARY_SUBSCR_TUPLE_INT",
301+
302+
# Tier 2
303+
"BINARY_SUBSCR_LIST_INT_REST",
301304
],
302305
"CALL": [
303306
"CALL_PY_EXACT_ARGS",
@@ -371,6 +374,9 @@ def pseudo_op(name, op, real_ops):
371374
"STORE_SUBSCR": [
372375
"STORE_SUBSCR_DICT",
373376
"STORE_SUBSCR_LIST_INT",
377+
378+
# Tier 2
379+
"STORE_SUBSCR_LIST_INT_REST",
374380
],
375381
"UNPACK_SEQUENCE": [
376382
"UNPACK_SEQUENCE_LIST",
@@ -495,9 +501,6 @@ def pseudo_op(name, op, real_ops):
495501
'BINARY_OP_MULTIPLY_INT_REST',
496502
'BINARY_OP_MULTIPLY_FLOAT_UNBOXED',
497503

498-
# Containers
499-
'BINARY_SUBSCR_LIST_INT_REST',
500-
'STORE_SUBSCR_LIST_INT_REST',
501504

502505
# Boxing / unboxing ops
503506
'POP_TOP_NO_DECREF',

Python/bytecodes.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ dummy_func(
437437
U_INST(BINARY_SUBSCR_LIST_INT_REST);
438438
}
439439

440-
u_inst(BINARY_SUBSCR_LIST_INT_REST, (list, sub -- res)) {
440+
u_inst(BINARY_SUBSCR_LIST_INT_REST, (unused/4, list, sub -- res)) {
441441
Py_ssize_t index = ((PyLongObject *)sub)->long_value.ob_digit[0];
442442
DEOPT_IF(index >= PyList_GET_SIZE(list), BINARY_SUBSCR);
443443
STAT_INC(BINARY_SUBSCR, hit);
@@ -556,7 +556,7 @@ dummy_func(
556556
U_INST(STORE_SUBSCR_LIST_INT_REST);
557557
}
558558

559-
u_inst(STORE_SUBSCR_LIST_INT_REST, (value, list, sub -- )) {
559+
u_inst(STORE_SUBSCR_LIST_INT_REST, (unused/1, value, list, sub -- )) {
560560
Py_ssize_t index = ((PyLongObject *)sub)->long_value.ob_digit[0];
561561
/* Ensure index < len(list) */
562562
DEOPT_IF(index >= PyList_GET_SIZE(list), STORE_SUBSCR);

Python/generated_cases.c.h

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)