GH-105229: Replace some superinstructions with single instruction equivalent. (GH-105230)

This commit is contained in:
Mark Shannon 2023-06-05 11:07:04 +01:00 committed by GitHub
parent e8ecb9ee6b
commit 0689340366
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 731 additions and 686 deletions

View file

@ -289,15 +289,6 @@ _PyCode_Quicken(PyCodeObject *code)
case LOAD_FAST << 8 | LOAD_CONST:
instructions[i - 1].op.code = LOAD_FAST__LOAD_CONST;
break;
case LOAD_FAST << 8 | LOAD_FAST:
instructions[i - 1].op.code = LOAD_FAST__LOAD_FAST;
break;
case STORE_FAST << 8 | LOAD_FAST:
instructions[i - 1].op.code = STORE_FAST__LOAD_FAST;
break;
case STORE_FAST << 8 | STORE_FAST:
instructions[i - 1].op.code = STORE_FAST__STORE_FAST;
break;
}
}
#endif /* ENABLE_SPECIALIZATION */
@ -1914,8 +1905,7 @@ _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
}
if (PyUnicode_CheckExact(lhs)) {
_Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_BINARY_OP + 1];
bool to_store = (next.op.code == STORE_FAST ||
next.op.code == STORE_FAST__LOAD_FAST);
bool to_store = (next.op.code == STORE_FAST);
if (to_store && locals[next.op.arg] == lhs) {
instr->op.code = BINARY_OP_INPLACE_ADD_UNICODE;
goto success;