mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
GH-116422: Modify a few uops so that they can be supported by tier 2 with hot/cold splitting (GH-116832)
This commit is contained in:
parent
a50cf6c3d7
commit
2cf18a4430
4 changed files with 52 additions and 55 deletions
32
Python/generated_cases.c.h
generated
32
Python/generated_cases.c.h
generated
|
@ -1174,14 +1174,12 @@
|
|||
DEOPT_IF(total_args != 1, CALL);
|
||||
DEOPT_IF(!PyCFunction_CheckExact(callable), CALL);
|
||||
DEOPT_IF(PyCFunction_GET_FLAGS(callable) != METH_O, CALL);
|
||||
// CPython promises to check all non-vectorcall function calls.
|
||||
DEOPT_IF(tstate->c_recursion_remaining <= 0, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunction cfunc = PyCFunction_GET_FUNCTION(callable);
|
||||
// This is slower but CPython promises to check all non-vectorcall
|
||||
// function calls.
|
||||
if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) {
|
||||
GOTO_ERROR(error);
|
||||
}
|
||||
PyObject *arg = args[0];
|
||||
_Py_EnterRecursiveCallTstateUnchecked(tstate);
|
||||
res = _PyCFunction_TrampolineCall(cfunc, PyCFunction_GET_SELF(callable), arg);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
|
@ -1350,10 +1348,12 @@
|
|||
}
|
||||
res = PyBool_FromLong(retval);
|
||||
assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
if (res == NULL) {
|
||||
GOTO_ERROR(error);
|
||||
}
|
||||
Py_DECREF(inst);
|
||||
Py_DECREF(cls);
|
||||
Py_DECREF(callable);
|
||||
if (res == NULL) { stack_pointer += -2 - oparg; goto error; }
|
||||
stack_pointer[-2 - oparg] = res;
|
||||
stack_pointer += -1 - oparg;
|
||||
DISPATCH();
|
||||
|
@ -1481,9 +1481,11 @@
|
|||
}
|
||||
res = PyLong_FromSsize_t(len_i);
|
||||
assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
if (res == NULL) {
|
||||
GOTO_ERROR(error);
|
||||
}
|
||||
Py_DECREF(callable);
|
||||
Py_DECREF(arg);
|
||||
if (res == NULL) { stack_pointer += -2 - oparg; goto error; }
|
||||
stack_pointer[-2 - oparg] = res;
|
||||
stack_pointer += -1 - oparg;
|
||||
DISPATCH();
|
||||
|
@ -1649,13 +1651,11 @@
|
|||
PyObject *self = args[0];
|
||||
DEOPT_IF(!Py_IS_TYPE(self, method->d_common.d_type), CALL);
|
||||
DEOPT_IF(meth->ml_flags != METH_NOARGS, CALL);
|
||||
// CPython promises to check all non-vectorcall function calls.
|
||||
DEOPT_IF(tstate->c_recursion_remaining <= 0, CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunction cfunc = meth->ml_meth;
|
||||
// This is slower but CPython promises to check all non-vectorcall
|
||||
// function calls.
|
||||
if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) {
|
||||
GOTO_ERROR(error);
|
||||
}
|
||||
_Py_EnterRecursiveCallTstateUnchecked(tstate);
|
||||
res = _PyCFunction_TrampolineCall(cfunc, self, NULL);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
|
@ -1698,16 +1698,14 @@
|
|||
DEOPT_IF(!Py_IS_TYPE(method, &PyMethodDescr_Type), CALL);
|
||||
PyMethodDef *meth = method->d_method;
|
||||
DEOPT_IF(meth->ml_flags != METH_O, CALL);
|
||||
// CPython promises to check all non-vectorcall function calls.
|
||||
DEOPT_IF(tstate->c_recursion_remaining <= 0, CALL);
|
||||
PyObject *arg = args[1];
|
||||
PyObject *self = args[0];
|
||||
DEOPT_IF(!Py_IS_TYPE(self, method->d_common.d_type), CALL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunction cfunc = meth->ml_meth;
|
||||
// This is slower but CPython promises to check all non-vectorcall
|
||||
// function calls.
|
||||
if (_Py_EnterRecursiveCallTstate(tstate, " while calling a Python object")) {
|
||||
GOTO_ERROR(error);
|
||||
}
|
||||
_Py_EnterRecursiveCallTstateUnchecked(tstate);
|
||||
res = _PyCFunction_TrampolineCall(cfunc, self, arg);
|
||||
_Py_LeaveRecursiveCallTstate(tstate);
|
||||
assert((res != NULL) ^ (_PyErr_Occurred(tstate) != NULL));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue