Skip to content

Commit 4f4d25d

Browse files
committed
gh-148235: remove duplicate uops _INSERT_1_LOAD_CONST_INLINE(_BORROW) in JIT
1 parent 0b20bff commit 4f4d25d

File tree

9 files changed

+1115
-1315
lines changed

9 files changed

+1115
-1315
lines changed

Include/internal/pycore_uop_ids.h

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

Include/internal/pycore_uop_metadata.h

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

Lib/test/test_capi/test_opt.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ def testfunc(n):
18461846
self.assertIsNotNone(ex)
18471847
uops = get_opnames(ex)
18481848
self.assertNotIn("_UNARY_INVERT", uops)
1849-
self.assertIn("_INSERT_1_LOAD_CONST_INLINE_BORROW", uops)
1849+
self.assertIn("_LOAD_CONST_INLINE_BORROW", uops)
18501850

18511851
def test_compare_op_pop_two_load_const_inline_borrow(self):
18521852
def testfunc(n):
@@ -4009,8 +4009,6 @@ class A:
40094009
self.assertIsNotNone(ex)
40104010
uops = get_opnames(ex)
40114011
self.assertNotIn("_REPLACE_WITH_TRUE", uops)
4012-
self.assertIn("_INSERT_1_LOAD_CONST_INLINE_BORROW", uops)
4013-
self.assertEqual(count_ops(ex, "_POP_TOP_NOP"), 1)
40144012

40154013
def test_attr_promotion_failure(self):
40164014
# We're not testing for any specific uops here, just

Python/bytecodes.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5924,18 +5924,6 @@ dummy_func(
59245924
value = PyStackRef_FromPyObjectBorrow(ptr);
59255925
}
59265926

5927-
tier2 op(_INSERT_1_LOAD_CONST_INLINE, (ptr/4, left -- res, l)) {
5928-
res = PyStackRef_FromPyObjectNew(ptr);
5929-
l = left;
5930-
INPUTS_DEAD();
5931-
}
5932-
5933-
tier2 op(_INSERT_1_LOAD_CONST_INLINE_BORROW, (ptr/4, left -- res, l)) {
5934-
res = PyStackRef_FromPyObjectBorrow(ptr);
5935-
l = left;
5936-
INPUTS_DEAD();
5937-
}
5938-
59395927
tier2 op(_INSERT_2_LOAD_CONST_INLINE_BORROW, (ptr/4, left, right -- res, l, r)) {
59405928
res = PyStackRef_FromPyObjectBorrow(ptr);
59415929
l = left;

Python/executor_cases.c.h

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

Python/optimizer_analysis.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ convert_global_to_const(_PyUOpInstruction *inst, PyObject *obj, bool pop, bool i
177177
}
178178
if (insert) {
179179
if (_Py_IsImmortal(res)) {
180-
inst->opcode = _INSERT_1_LOAD_CONST_INLINE_BORROW;
180+
inst->opcode = _LOAD_CONST_UNDER_INLINE_BORROW;
181181
} else {
182-
inst->opcode = _INSERT_1_LOAD_CONST_INLINE;
182+
inst->opcode = _LOAD_CONST_UNDER_INLINE;
183183
}
184184
} else {
185185
if (_Py_IsImmortal(res)) {
@@ -341,7 +341,7 @@ optimize_to_bool(
341341
if (truthiness >= 0) {
342342
PyObject *load = truthiness ? Py_True : Py_False;
343343
int opcode = insert_mode ?
344-
_INSERT_1_LOAD_CONST_INLINE_BORROW :
344+
_LOAD_CONST_UNDER_INLINE_BORROW :
345345
_POP_TOP_LOAD_CONST_INLINE_BORROW;
346346
ADD_OP(opcode, 0, (uintptr_t)load);
347347
*result_ptr = sym_new_const(ctx, load);

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ dummy_func(void) {
16101610
}
16111611

16121612
op(_REPLACE_WITH_TRUE, (value -- res, v)) {
1613-
ADD_OP(_INSERT_1_LOAD_CONST_INLINE_BORROW, 0, (uintptr_t)Py_True);
1613+
ADD_OP(_LOAD_CONST_UNDER_INLINE_BORROW, 0, (uintptr_t)Py_True);
16141614
res = sym_new_const(ctx, Py_True);
16151615
v = value;
16161616
}

Python/optimizer_cases.c.h

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

Tools/cases_generator/optimizer_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def replace_opcode_if_evaluates_pure(
242242
0: "_POP_TOP_LOAD_CONST_INLINE_BORROW",
243243
# (left -- res, left)
244244
# usually for unary ops with passthrough references
245-
1: "_INSERT_1_LOAD_CONST_INLINE_BORROW",
245+
1: "_LOAD_CONST_UNDER_INLINE_BORROW",
246246
},
247247
2: {
248248
# (a. b -- res), usually for binary ops

0 commit comments

Comments
 (0)