mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-130415: Remove redundant sym_matches_type calls in the JIT optimizer (GH-131778)
This commit is contained in:
parent
a096a41b92
commit
972a295fe3
2 changed files with 26 additions and 48 deletions
37
Python/optimizer_cases.c.h
generated
37
Python/optimizer_cases.c.h
generated
|
@ -271,9 +271,7 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyLong_Type) && sym_matches_type(right, &PyLong_Type))
|
||||
{
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = _PyLong_Multiply((PyLongObject *)sym_get_const(ctx, left),
|
||||
|
@ -304,9 +302,7 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyLong_Type) && sym_matches_type(right, &PyLong_Type))
|
||||
{
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = _PyLong_Add((PyLongObject *)sym_get_const(ctx, left),
|
||||
|
@ -337,9 +333,7 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyLong_Type) && sym_matches_type(right, &PyLong_Type))
|
||||
{
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = _PyLong_Subtract((PyLongObject *)sym_get_const(ctx, left),
|
||||
|
@ -401,9 +395,7 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyFloat_Type) && sym_matches_type(right, &PyFloat_Type))
|
||||
{
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyFloat_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyFloat_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = PyFloat_FromDouble(
|
||||
|
@ -435,9 +427,7 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyFloat_Type) && sym_matches_type(right, &PyFloat_Type))
|
||||
{
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyFloat_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyFloat_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = PyFloat_FromDouble(
|
||||
|
@ -469,9 +459,7 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyFloat_Type) && sym_matches_type(right, &PyFloat_Type))
|
||||
{
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyFloat_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyFloat_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = PyFloat_FromDouble(
|
||||
|
@ -517,8 +505,9 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyUnicode_Type) && sym_matches_type(right, &PyUnicode_Type)) {
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyUnicode_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyUnicode_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = PyUnicode_Concat(sym_get_const(ctx, left), sym_get_const(ctx, right));
|
||||
if (temp == NULL) {
|
||||
goto error;
|
||||
|
@ -544,8 +533,9 @@
|
|||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
JitOptSymbol *res;
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right) &&
|
||||
sym_matches_type(left, &PyUnicode_Type) && sym_matches_type(right, &PyUnicode_Type)) {
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyUnicode_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyUnicode_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *temp = PyUnicode_Concat(sym_get_const(ctx, left), sym_get_const(ctx, right));
|
||||
if (temp == NULL) {
|
||||
goto error;
|
||||
|
@ -1275,8 +1265,7 @@
|
|||
JitOptSymbol *res;
|
||||
right = stack_pointer[-1];
|
||||
left = stack_pointer[-2];
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right))
|
||||
{
|
||||
if (sym_is_const(ctx, left) && sym_is_const(ctx, right)) {
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, left)));
|
||||
assert(PyLong_CheckExact(sym_get_const(ctx, right)));
|
||||
PyObject *tmp = PyObject_RichCompare(sym_get_const(ctx, left),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue