GH-118093: Add tier two support for BINARY_OP_INPLACE_ADD_UNICODE (GH-122253)

This commit is contained in:
Brandt Bucher 2024-07-25 14:45:07 -07:00 committed by GitHub
parent 1d607fe759
commit d9efa45d74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 241 additions and 153 deletions

View file

@ -581,12 +581,18 @@ dummy_func(
// So the inputs are the same as for all BINARY_OP
// specializations, but there is no output.
// At the end we just skip over the STORE_FAST.
tier1 op(_BINARY_OP_INPLACE_ADD_UNICODE, (left, right --)) {
op(_BINARY_OP_INPLACE_ADD_UNICODE, (left, right --)) {
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
int next_oparg;
#if TIER_ONE
assert(next_instr->op.code == STORE_FAST);
_PyStackRef *target_local = &GETLOCAL(next_instr->op.arg);
next_oparg = next_instr->op.arg;
#else
next_oparg = CURRENT_OPERAND();
#endif
_PyStackRef *target_local = &GETLOCAL(next_oparg);
DEOPT_IF(!PyStackRef_Is(*target_local, left));
STAT_INC(BINARY_OP, hit);
/* Handle `left = left + right` or `left += right` for str.
@ -607,9 +613,12 @@ dummy_func(
*target_local = PyStackRef_FromPyObjectSteal(temp);
_Py_DECREF_SPECIALIZED(right_o, _PyUnicode_ExactDealloc);
ERROR_IF(PyStackRef_IsNull(*target_local), error);
// The STORE_FAST is already done.
#if TIER_ONE
// The STORE_FAST is already done. This is done here in tier one,
// and during trace projection in tier two:
assert(next_instr->op.code == STORE_FAST);
SKIP_OVER(1);
#endif
}
macro(BINARY_OP_INPLACE_ADD_UNICODE) =