Skip to content

Commit bd2a9d8

Browse files
committed
use _LOAD_COMMON_CONSTANT and update tests
1 parent ba91a21 commit bd2a9d8

3 files changed

Lines changed: 8 additions & 11 deletions

File tree

Lib/test/test_capi/test_opt.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5710,7 +5710,6 @@ class A:
57105710
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
57115711
self.assertEqual(res, TIER2_THRESHOLD)
57125712
uops = get_opnames(ex)
5713-
57145713
self.assertIn("_MATCH_CLASS", uops)
57155714
self.assertEqual(count_ops(ex, "_POP_TOP_NOP"), 4)
57165715

@@ -5728,9 +5727,8 @@ def testfunc(n):
57285727
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
57295728
self.assertEqual(res, TIER2_THRESHOLD)
57305729
uops = get_opnames(ex)
5731-
5732-
self.assertIn("_MATCH_MAPPING", uops)
5733-
self.assertNotIn("_GUARD_BIT_IS_SET_POP", uops)
5730+
self.assertNotIn("_MATCH_MAPPING", uops)
5731+
self.assertIn("_LOAD_COMMON_CONSTANT", uops)
57345732

57355733
def test_match_sequence(self):
57365734
def testfunc(n):
@@ -5745,9 +5743,8 @@ def testfunc(n):
57455743
res, ex = self._run_with_optimizer(testfunc, TIER2_THRESHOLD)
57465744
self.assertEqual(res, TIER2_THRESHOLD)
57475745
uops = get_opnames(ex)
5748-
5749-
self.assertIn("_MATCH_SEQUENCE", uops)
5750-
self.assertNotIn("_GUARD_BIT_IS_SET_POP", uops)
5746+
self.assertNotIn("_MATCH_SEQUENCE", uops)
5747+
self.assertIn("_LOAD_COMMON_CONSTANT", uops)
57515748

57525749
def test_dict_update(self):
57535750
def testfunc(n):

Python/optimizer_bytecodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ dummy_func(void) {
25992599
PyTypeObject *type = sym_get_type(subject);
26002600
if (type != NULL) {
26012601
int match = type->tp_flags & Py_TPFLAGS_MAPPING;
2602-
REPLACE_OP(this_instr, _LOAD_COMMON_CONST, match? CONSTANT_TRUE : CONSTANT_FALSE, 0);
2602+
REPLACE_OP(this_instr, _LOAD_COMMON_CONSTANT, match? CONSTANT_TRUE : CONSTANT_FALSE, 0);
26032603
}
26042604
else {
26052605
res = sym_new_type(ctx, &PyBool_Type);
@@ -2610,7 +2610,7 @@ dummy_func(void) {
26102610
PyTypeObject *type = sym_get_type(subject);
26112611
if (type != NULL) {
26122612
int match = type->tp_flags & Py_TPFLAGS_SEQUENCE;
2613-
REPLACE_OP(this_instr, _LOAD_COMMON_CONST, match? CONSTANT_TRUE : CONSTANT_FALSE, 0);
2613+
REPLACE_OP(this_instr, _LOAD_COMMON_CONSTANT, match? CONSTANT_TRUE : CONSTANT_FALSE, 0);
26142614
}
26152615
else {
26162616
res = sym_new_type(ctx, &PyBool_Type);

Python/optimizer_cases.c.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.

0 commit comments

Comments
 (0)