@@ -85,13 +85,14 @@ static PyObject *list, *tuple, *dict;
85
85
static PyObject * exit_func , * lasti , * val ;
86
86
static PyObject * jump ;
87
87
// Dummy variables for stack effects
88
- static int when_to_jump_mask ;
88
+ static _Py_CODEUNIT when_to_jump_mask , invert ;
89
89
// Dummy opcode names for 'op' opcodes
90
90
#define _BINARY_OP_INPLACE_ADD_UNICODE_PART_1 1001
91
91
#define _BINARY_OP_INPLACE_ADD_UNICODE_PART_2 1002
92
92
#define _COMPARE_OP_FLOAT 1003
93
93
#define _COMPARE_OP_INT 1004
94
- #define _JUMP_ON_SIGN 1005
94
+ #define _COMPARE_OP_STR 1005
95
+ #define _JUMP_ON_SIGN 1006
95
96
96
97
static PyObject *
97
98
dummy_func (
@@ -2065,7 +2066,7 @@ dummy_func(
2065
2066
COMPARE_OP ,
2066
2067
_COMPARE_OP_FLOAT ,
2067
2068
_COMPARE_OP_INT ,
2068
- // COMPARE_OP_STR_JUMP ,
2069
+ _COMPARE_OP_STR ,
2069
2070
};
2070
2071
2071
2072
inst (COMPARE_OP , (unused /1 , left , right , unused /1 -- res )) {
@@ -2132,35 +2133,22 @@ dummy_func(
2132
2133
}
2133
2134
super (COMPARE_OP_INT_JUMP ) = _COMPARE_OP_INT + _JUMP_ON_SIGN ;
2134
2135
2135
- // stack effect: (__0 -- )
2136
- inst ( COMPARE_OP_STR_JUMP ) {
2136
+ // Similar to COMPARE_OP_FLOAT, but for ==, != only
2137
+ op ( _COMPARE_OP_STR , ( unused / 1 , left , right , invert / 1 -- jump ) ) {
2137
2138
assert (cframe .use_tracing == 0 );
2138
2139
// Combined: COMPARE_OP (str == str or str != str) + POP_JUMP_IF_(true/false)
2139
- _PyCompareOpCache * cache = (_PyCompareOpCache * )next_instr ;
2140
- int invert = cache -> mask ;
2141
- PyObject * right = TOP ();
2142
- PyObject * left = SECOND ();
2143
2140
DEOPT_IF (!PyUnicode_CheckExact (left ), COMPARE_OP );
2144
2141
DEOPT_IF (!PyUnicode_CheckExact (right ), COMPARE_OP );
2145
2142
STAT_INC (COMPARE_OP , hit );
2146
2143
int res = _PyUnicode_Equal (left , right );
2147
2144
assert (oparg == Py_EQ || oparg == Py_NE );
2148
- JUMPBY (INLINE_CACHE_ENTRIES_COMPARE_OP );
2149
- NEXTOPARG ();
2150
- assert (opcode == POP_JUMP_IF_FALSE || opcode == POP_JUMP_IF_TRUE );
2151
- STACK_SHRINK (2 );
2152
2145
_Py_DECREF_SPECIALIZED (left , _PyUnicode_ExactDealloc );
2153
2146
_Py_DECREF_SPECIALIZED (right , _PyUnicode_ExactDealloc );
2154
2147
assert (res == 0 || res == 1 );
2155
2148
assert (invert == 0 || invert == 1 );
2156
- int jump = res ^ invert ;
2157
- if (!jump ) {
2158
- next_instr ++ ;
2159
- }
2160
- else {
2161
- JUMPBY (1 + oparg );
2162
- }
2149
+ jump = (PyObject * )(size_t )(res ^ invert );
2163
2150
}
2151
+ super (COMPARE_OP_STR_JUMP ) = _COMPARE_OP_STR + _JUMP_ON_SIGN ;
2164
2152
2165
2153
// stack effect: (__0 -- )
2166
2154
inst (IS_OP ) {
0 commit comments