diff options
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 0b2c9e8..27ef45f 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -196,7 +196,6 @@ dummy_func( BINARY_OP_ADD_FLOAT, BINARY_OP_ADD_INT, BINARY_OP_ADD_UNICODE, - BINARY_OP_GENERIC, // BINARY_OP_INPLACE_ADD_UNICODE, // This is an odd duck. BINARY_OP_MULTIPLY_FLOAT, BINARY_OP_MULTIPLY_INT, @@ -2075,21 +2074,6 @@ dummy_func( } // stack effect: (__0 -- ) - inst(COMPARE_OP_GENERIC) { - assert(oparg <= Py_GE); - PyObject *right = POP(); - PyObject *left = TOP(); - PyObject *res = PyObject_RichCompare(left, right, oparg); - SET_TOP(res); - Py_DECREF(left); - Py_DECREF(right); - if (res == NULL) { - goto error; - } - JUMPBY(INLINE_CACHE_ENTRIES_COMPARE_OP); - } - - // stack effect: (__0 -- ) inst(COMPARE_OP) { _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2102,7 +2086,17 @@ dummy_func( } STAT_INC(COMPARE_OP, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); - GO_TO_INSTRUCTION(COMPARE_OP_GENERIC); + assert(oparg <= Py_GE); + PyObject *right = POP(); + PyObject *left = TOP(); + PyObject *res = PyObject_RichCompare(left, right, oparg); + SET_TOP(res); + Py_DECREF(left); + Py_DECREF(right); + if (res == NULL) { + goto error; + } + JUMPBY(INLINE_CACHE_ENTRIES_COMPARE_OP); } // stack effect: (__0 -- ) @@ -3662,18 +3656,7 @@ dummy_func( PUSH(Py_NewRef(peek)); } - inst(BINARY_OP_GENERIC, (lhs, rhs, unused/1 -- res)) { - assert(0 <= oparg); - assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); - assert(binary_ops[oparg]); - res = binary_ops[oparg](lhs, rhs); - Py_DECREF(lhs); - Py_DECREF(rhs); - ERROR_IF(res == NULL, error); - } - - // This always dispatches, so the result is unused. - inst(BINARY_OP, (lhs, rhs, unused/1 -- unused)) { + inst(BINARY_OP, (lhs, rhs, unused/1 -- res)) { _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { assert(cframe.use_tracing == 0); @@ -3683,7 +3666,13 @@ dummy_func( } STAT_INC(BINARY_OP, deferred); DECREMENT_ADAPTIVE_COUNTER(cache->counter); - GO_TO_INSTRUCTION(BINARY_OP_GENERIC); + assert(0 <= oparg); + assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); + assert(binary_ops[oparg]); + res = binary_ops[oparg](lhs, rhs); + Py_DECREF(lhs); + Py_DECREF(rhs); + ERROR_IF(res == NULL, error); } // stack effect: ( -- ) @@ -3737,7 +3726,7 @@ family(call) = { CALL_NO_KW_METHOD_DESCRIPTOR_O, CALL_NO_KW_STR_1, CALL_NO_KW_TUPLE_1, CALL_NO_KW_TYPE_1 }; family(compare_op) = { - COMPARE_OP, COMPARE_OP_FLOAT_JUMP, COMPARE_OP_GENERIC, + COMPARE_OP, COMPARE_OP_FLOAT_JUMP, COMPARE_OP_INT_JUMP, COMPARE_OP_STR_JUMP }; family(for_iter) = { FOR_ITER, FOR_ITER_LIST, |