mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)
This commit is contained in:
parent
6f8b0e781c
commit
8555dee5ae
8 changed files with 161 additions and 206 deletions
60
Python/generated_cases.c.h
generated
60
Python/generated_cases.c.h
generated
|
@ -2077,22 +2077,6 @@
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(COMPARE_OP_GENERIC) {
|
||||
PREDICTED(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);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(COMPARE_OP) {
|
||||
PREDICTED(COMPARE_OP);
|
||||
_PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr;
|
||||
|
@ -2106,7 +2090,18 @@
|
|||
}
|
||||
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);
|
||||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(COMPARE_OP_FLOAT_JUMP) {
|
||||
|
@ -3667,11 +3662,21 @@
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(BINARY_OP_GENERIC) {
|
||||
PREDICTED(BINARY_OP_GENERIC);
|
||||
TARGET(BINARY_OP) {
|
||||
PREDICTED(BINARY_OP);
|
||||
assert(INLINE_CACHE_ENTRIES_BINARY_OP == 1);
|
||||
PyObject *rhs = PEEK(1);
|
||||
PyObject *lhs = PEEK(2);
|
||||
PyObject *res;
|
||||
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
next_instr--;
|
||||
_Py_Specialize_BinaryOp(lhs, rhs, next_instr, oparg, &GETLOCAL(0));
|
||||
DISPATCH_SAME_OPARG();
|
||||
}
|
||||
STAT_INC(BINARY_OP, deferred);
|
||||
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||
assert(0 <= oparg);
|
||||
assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops));
|
||||
assert(binary_ops[oparg]);
|
||||
|
@ -3685,23 +3690,6 @@
|
|||
DISPATCH();
|
||||
}
|
||||
|
||||
TARGET(BINARY_OP) {
|
||||
PREDICTED(BINARY_OP);
|
||||
assert(INLINE_CACHE_ENTRIES_BINARY_OP == 1);
|
||||
PyObject *rhs = PEEK(1);
|
||||
PyObject *lhs = PEEK(2);
|
||||
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
|
||||
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
|
||||
assert(cframe.use_tracing == 0);
|
||||
next_instr--;
|
||||
_Py_Specialize_BinaryOp(lhs, rhs, next_instr, oparg, &GETLOCAL(0));
|
||||
DISPATCH_SAME_OPARG();
|
||||
}
|
||||
STAT_INC(BINARY_OP, deferred);
|
||||
DECREMENT_ADAPTIVE_COUNTER(cache->counter);
|
||||
GO_TO_INSTRUCTION(BINARY_OP_GENERIC);
|
||||
}
|
||||
|
||||
TARGET(SWAP) {
|
||||
assert(oparg != 0);
|
||||
PyObject *top = TOP();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue