Skip to content

Commit f23b6fb

Browse files
committed
BINARY_OP_INPLACE_ADD_UNICODE
1 parent 73fab62 commit f23b6fb

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

Python/bytecodes.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,14 @@ dummy_func(
315315
JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
316316
}
317317

318-
// stack effect: (__0 -- )
319-
inst(BINARY_OP_INPLACE_ADD_UNICODE) {
318+
// This is a weird one. It's a super-instruction for
319+
// BINARY_OP_ADD_UNICODE followed by STORE_FAST
320+
// where the store goes into the left argument.
321+
// So the inputs are the same as for all BINARY_OP
322+
// specializations, but there is no output.
323+
// At the end we just skip over the STORE_FAST.
324+
inst(BINARY_OP_INPLACE_ADD_UNICODE, (left, right --)) {
320325
assert(cframe.use_tracing == 0);
321-
PyObject *left = SECOND();
322-
PyObject *right = TOP();
323326
DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP);
324327
DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP);
325328
_Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP];
@@ -341,12 +344,9 @@ dummy_func(
341344
*/
342345
assert(Py_REFCNT(left) >= 2);
343346
_Py_DECREF_NO_DEALLOC(left);
344-
STACK_SHRINK(2);
345347
PyUnicode_Append(target_local, right);
346348
_Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc);
347-
if (*target_local == NULL) {
348-
goto error;
349-
}
349+
ERROR_IF(*target_local == NULL, error);
350350
// The STORE_FAST is already done.
351351
JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1);
352352
}

Python/generated_cases.c.h

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

0 commit comments

Comments
 (0)