@@ -92,8 +92,6 @@ static PyObject * import_from(PyThreadState *, PyObject *, PyObject *);
92
92
static int import_all_from (PyThreadState * , PyObject * , PyObject * );
93
93
static void format_exc_check_arg (PyThreadState * , PyObject * , const char * , PyObject * );
94
94
static void format_exc_unbound (PyThreadState * tstate , PyCodeObject * co , int oparg );
95
- static PyObject * unicode_concatenate (PyThreadState * , PyObject * , PyObject * ,
96
- InterpreterFrame * , const _Py_CODEUNIT * );
97
95
static int check_args_iterable (PyThreadState * , PyObject * func , PyObject * vararg );
98
96
static void format_kwargs_error (PyThreadState * , PyObject * func , PyObject * kwargs );
99
97
static void format_awaitable_error (PyThreadState * , PyTypeObject * , int , int );
@@ -4706,13 +4704,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4706
4704
res = PyNumber_Xor (lhs , rhs );
4707
4705
break ;
4708
4706
case NB_INPLACE_ADD :
4709
- if (PyUnicode_CheckExact (lhs ) && PyUnicode_CheckExact (rhs ))
4710
- {
4711
- Py_INCREF (lhs ); // unicode_concatenate steals lhs!
4712
- res = unicode_concatenate (tstate , lhs , rhs , frame ,
4713
- next_instr );
4714
- break ;
4715
- }
4716
4707
res = PyNumber_InPlaceAdd (lhs , rhs );
4717
4708
break ;
4718
4709
case NB_INPLACE_AND :
@@ -4766,18 +4757,20 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
4766
4757
TARGET (BINARY_OP_ADAPTIVE ) {
4767
4758
assert (cframe .use_tracing == 0 );
4768
4759
SpecializedCacheEntry * cache = GET_CACHE ();
4769
- if (cache -> adaptive .counter ) {
4760
+ if (cache -> adaptive .counter == 0 ) {
4761
+ PyObject * lhs = SECOND ();
4762
+ PyObject * rhs = TOP ();
4763
+ next_instr -- ;
4764
+ _Py_Specialize_BinaryOp (lhs , rhs , next_instr , cache );
4765
+ DISPATCH ();
4766
+ }
4767
+ else {
4768
+ STAT_INC (BINARY_OP , deferred );
4770
4769
cache -> adaptive .counter -- ;
4771
4770
oparg = cache -> adaptive .original_oparg ;
4772
- STAT_INC (BINARY_OP , deferred );
4773
4771
STAT_DEC (BINARY_OP , unquickened );
4774
4772
JUMP_TO_INSTRUCTION (BINARY_OP );
4775
4773
}
4776
- PyObject * lhs = SECOND ();
4777
- PyObject * rhs = TOP ();
4778
- next_instr -- ;
4779
- _Py_Specialize_BinaryOp (lhs , rhs , next_instr , cache );
4780
- DISPATCH ();
4781
4774
}
4782
4775
4783
4776
TARGET (EXTENDED_ARG ) {
@@ -6901,60 +6894,6 @@ format_awaitable_error(PyThreadState *tstate, PyTypeObject *type, int prevprevop
6901
6894
}
6902
6895
}
6903
6896
6904
- static PyObject *
6905
- unicode_concatenate (PyThreadState * tstate , PyObject * v , PyObject * w ,
6906
- InterpreterFrame * frame , const _Py_CODEUNIT * next_instr )
6907
- {
6908
- PyObject * res ;
6909
- if (Py_REFCNT (v ) == 2 ) {
6910
- /* In the common case, there are 2 references to the value
6911
- * stored in 'variable' when the += is performed: one on the
6912
- * value stack (in 'v') and one still stored in the
6913
- * 'variable'. We try to delete the variable now to reduce
6914
- * the refcnt to 1.
6915
- */
6916
- int opcode , oparg ;
6917
- NEXTOPARG ();
6918
- next_instr ++ ;
6919
- switch (opcode ) {
6920
- case STORE_FAST :
6921
- {
6922
- if (GETLOCAL (oparg ) == v )
6923
- SETLOCAL (oparg , NULL );
6924
- break ;
6925
- }
6926
- case STORE_DEREF :
6927
- {
6928
- PyObject * c = _PyFrame_GetLocalsArray (frame )[oparg ];
6929
- if (PyCell_GET (c ) == v ) {
6930
- PyCell_SET (c , NULL );
6931
- Py_DECREF (v );
6932
- }
6933
- break ;
6934
- }
6935
- case STORE_NAME :
6936
- {
6937
- PyObject * names = frame -> f_code -> co_names ;
6938
- PyObject * name = GETITEM (names , oparg );
6939
- PyObject * locals = frame -> f_locals ;
6940
- if (locals && PyDict_CheckExact (locals )) {
6941
- PyObject * w = PyDict_GetItemWithError (locals , name );
6942
- if ((w == v && PyDict_DelItem (locals , name ) != 0 ) ||
6943
- (w == NULL && _PyErr_Occurred (tstate )))
6944
- {
6945
- Py_DECREF (v );
6946
- return NULL ;
6947
- }
6948
- }
6949
- break ;
6950
- }
6951
- }
6952
- }
6953
- res = v ;
6954
- PyUnicode_Append (& res , w );
6955
- return res ;
6956
- }
6957
-
6958
6897
#ifdef DYNAMIC_EXECUTION_PROFILE
6959
6898
6960
6899
static PyObject *
0 commit comments