mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-138302: Specialize int ops only if ints are compact (GH-138347)
This commit is contained in:
parent
6528cf47a0
commit
ea77feecbb
3 changed files with 21 additions and 3 deletions
|
|
@ -2595,7 +2595,7 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
|
|||
specialize(instr, BINARY_OP_ADD_UNICODE);
|
||||
return;
|
||||
}
|
||||
if (PyLong_CheckExact(lhs)) {
|
||||
if (_PyLong_CheckExactAndCompact(lhs) && _PyLong_CheckExactAndCompact(rhs)) {
|
||||
specialize(instr, BINARY_OP_ADD_INT);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2609,7 +2609,7 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
|
|||
if (!Py_IS_TYPE(lhs, Py_TYPE(rhs))) {
|
||||
break;
|
||||
}
|
||||
if (PyLong_CheckExact(lhs)) {
|
||||
if (_PyLong_CheckExactAndCompact(lhs) && _PyLong_CheckExactAndCompact(rhs)) {
|
||||
specialize(instr, BINARY_OP_MULTIPLY_INT);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2623,7 +2623,7 @@ _Py_Specialize_BinaryOp(_PyStackRef lhs_st, _PyStackRef rhs_st, _Py_CODEUNIT *in
|
|||
if (!Py_IS_TYPE(lhs, Py_TYPE(rhs))) {
|
||||
break;
|
||||
}
|
||||
if (PyLong_CheckExact(lhs)) {
|
||||
if (_PyLong_CheckExactAndCompact(lhs) && _PyLong_CheckExactAndCompact(rhs)) {
|
||||
specialize(instr, BINARY_OP_SUBTRACT_INT);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue