Skip to content

Commit 32b4ac0

Browse files
committed
Revert "Make BINARY_OP_INPLACE_ADD_UNICODE a legit super instruction"
It was too fancy, and I have another idea for super instructions and effects anyways. This reverts commit 6860ed7.
1 parent 445f20b commit 32b4ac0

File tree

2 files changed

+44
-52
lines changed

2 files changed

+44
-52
lines changed

Python/bytecodes.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ dummy_func(
208208
BINARY_OP_ADD_FLOAT,
209209
BINARY_OP_ADD_INT,
210210
BINARY_OP_ADD_UNICODE,
211-
_BINARY_OP_INPLACE_ADD_UNICODE_PART_1,
211+
// BINARY_OP_INPLACE_ADD_UNICODE, // This is an odd duck.
212212
BINARY_OP_MULTIPLY_FLOAT,
213213
BINARY_OP_MULTIPLY_INT,
214214
BINARY_OP_SUBTRACT_FLOAT,
@@ -274,10 +274,13 @@ dummy_func(
274274
ERROR_IF(res == NULL, error);
275275
}
276276

277-
// Part 1's output effect is a lie -- it has no result.
278-
// Part 2's input effect is equally a lie, and the two lies
279-
// cancel each other out.
280-
op(_BINARY_OP_INPLACE_ADD_UNICODE_PART_1, (unused/1, left, right -- unused)) {
277+
// This is a subtle one. It's a super-instruction for
278+
// BINARY_OP_ADD_UNICODE followed by STORE_FAST
279+
// where the store goes into the left argument.
280+
// So the inputs are the same as for all BINARY_OP
281+
// specializations, but there is no output.
282+
// At the end we just skip over the STORE_FAST.
283+
inst(BINARY_OP_INPLACE_ADD_UNICODE, (left, right --)) {
281284
assert(cframe.use_tracing == 0);
282285
DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP);
283286
DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP);
@@ -303,12 +306,9 @@ dummy_func(
303306
PyUnicode_Append(target_local, right);
304307
_Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc);
305308
ERROR_IF(*target_local == NULL, error);
309+
// The STORE_FAST is already done.
310+
JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1);
306311
}
307-
op(_BINARY_OP_INPLACE_ADD_UNICODE_PART_2, (unused --)) {
308-
// The STORE_FAST is already done; oparg is dead.
309-
}
310-
super(BINARY_OP_INPLACE_ADD_UNICODE) =
311-
_BINARY_OP_INPLACE_ADD_UNICODE_PART_1 + _BINARY_OP_INPLACE_ADD_UNICODE_PART_2;
312312

313313
inst(BINARY_OP_ADD_FLOAT, (unused/1, left, right -- sum)) {
314314
assert(cframe.use_tracing == 0);

Python/generated_cases.c.h

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

0 commit comments

Comments
 (0)