diff options
author | Brandt Bucher <brandtbucher@microsoft.com> | 2022-11-17 11:36:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-17 11:36:57 -0800 |
commit | 8555dee5aeedb2f37ee2e2216ef8707be0fc1d9d (patch) | |
tree | 24c7994850152002b8c22a737b875279b5f25e09 /Python/generated_cases.c.h | |
parent | 6f8b0e781ccd5d17f00f91d1c4eddba4f3e9a8ed (diff) | |
download | cpython-git-8555dee5aeedb2f37ee2e2216ef8707be0fc1d9d.tar.gz |
GH-98686: Get rid of BINARY_OP_GENERIC and COMPARE_OP_GENERIC (GH-99399)
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r-- | Python/generated_cases.c.h | 60 |
1 files changed, 24 insertions, 36 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 7864647bc8..b60655884c 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -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,29 +3662,12 @@ DISPATCH(); } - TARGET(BINARY_OP_GENERIC) { - PREDICTED(BINARY_OP_GENERIC); - PyObject *rhs = PEEK(1); - PyObject *lhs = PEEK(2); - PyObject *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); - if (res == NULL) goto pop_2_error; - STACK_SHRINK(1); - POKE(1, res); - next_instr += 1; - DISPATCH(); - } - 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); @@ -3699,7 +3677,17 @@ } 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); + if (res == NULL) goto pop_2_error; + STACK_SHRINK(1); + POKE(1, res); + next_instr += 1; + DISPATCH(); } TARGET(SWAP) { |