mirror of
https://github.com/python/cpython.git
synced 2026-04-20 10:51:00 +00:00
gh-148171: convert more variadic uops to leave input on stack in JIT (#148361)
This commit is contained in:
parent
dd88e77fad
commit
2b439da972
11 changed files with 232 additions and 200 deletions
|
|
@ -4907,7 +4907,7 @@ dummy_func(
|
|||
EXIT_IF(!Py_IS_TYPE(self, method->d_common.d_type));
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- res)) {
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
|
||||
|
|
@ -4921,36 +4921,38 @@ dummy_func(
|
|||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunctionFastWithKeywords cfunc = _PyCFunctionFastWithKeywords_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRef(
|
||||
callable,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
);
|
||||
DEAD(args);
|
||||
DEAD(self_or_null);
|
||||
DEAD(callable);
|
||||
ERROR_IF(res_o == NULL);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
if (res_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
_PyStackRef temp = callable;
|
||||
callable = PyStackRef_FromPyObjectSteal(res_o);
|
||||
PyStackRef_CLOSE(temp);
|
||||
}
|
||||
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
assert(self != NULL);
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, (callable, self_st, args[oparg], cfunc/4 -- callable, self_st, args[oparg])) {
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunctionFastWithKeywords cfunc_v = _PyCFunctionFastWithKeywords_CAST(cfunc);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRefSteal(
|
||||
PyObject *res_o = _PyCallMethodDescriptorFastWithKeywords_StackRef(
|
||||
callable,
|
||||
cfunc_v,
|
||||
self,
|
||||
args,
|
||||
oparg
|
||||
args - 1,
|
||||
oparg + 1
|
||||
);
|
||||
DEAD(args);
|
||||
DEAD(callable);
|
||||
ERROR_IF(res_o == NULL);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
if (res_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
_PyStackRef temp = callable;
|
||||
callable = PyStackRef_FromPyObjectSteal(res_o);
|
||||
PyStackRef_CLOSE(temp);
|
||||
}
|
||||
|
||||
macro(CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS) =
|
||||
|
|
@ -4959,6 +4961,8 @@ dummy_func(
|
|||
unused/2 +
|
||||
_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS +
|
||||
_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS +
|
||||
_POP_TOP_OPARG +
|
||||
POP_TOP +
|
||||
_CHECK_PERIODIC_AT_END;
|
||||
|
||||
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_NOARGS, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
|
||||
|
|
@ -5045,7 +5049,7 @@ dummy_func(
|
|||
EXIT_IF(!Py_IS_TYPE(self, method->d_common.d_type));
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- res)) {
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
|
||||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
|
||||
|
|
@ -5059,36 +5063,39 @@ dummy_func(
|
|||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
PyCFunctionFast cfunc = _PyCFunctionFast_CAST(method->d_method->ml_meth);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRef(
|
||||
callable,
|
||||
cfunc,
|
||||
self,
|
||||
arguments,
|
||||
total_args
|
||||
);
|
||||
DEAD(args);
|
||||
DEAD(self_or_null);
|
||||
DEAD(callable);
|
||||
ERROR_IF(res_o == NULL);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
if (res_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
_PyStackRef temp = callable;
|
||||
callable = PyStackRef_FromPyObjectSteal(res_o);
|
||||
PyStackRef_CLOSE(temp);
|
||||
}
|
||||
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, (callable, args[oparg], cfunc/4 -- res)) {
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(args[0]);
|
||||
tier2 op(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, (callable, self_st, args[oparg], cfunc/4 -- callable, self_st, args[oparg])) {
|
||||
PyObject *self = PyStackRef_AsPyObjectBorrow(self_st);
|
||||
assert(self != NULL);
|
||||
STAT_INC(CALL, hit);
|
||||
volatile PyCFunctionFast cfunc_v = _PyCFunctionFast_CAST(cfunc);
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRefSteal(
|
||||
PyObject *res_o = _PyCallMethodDescriptorFast_StackRef(
|
||||
callable,
|
||||
cfunc_v,
|
||||
self,
|
||||
args,
|
||||
oparg
|
||||
args - 1,
|
||||
oparg + 1
|
||||
);
|
||||
DEAD(args);
|
||||
DEAD(callable);
|
||||
ERROR_IF(res_o == NULL);
|
||||
res = PyStackRef_FromPyObjectSteal(res_o);
|
||||
if (res_o == NULL) {
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
_PyStackRef temp = callable;
|
||||
callable = PyStackRef_FromPyObjectSteal(res_o);
|
||||
PyStackRef_CLOSE(temp);
|
||||
}
|
||||
|
||||
macro(CALL_METHOD_DESCRIPTOR_FAST) =
|
||||
|
|
@ -5096,6 +5103,8 @@ dummy_func(
|
|||
unused/2 +
|
||||
_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST +
|
||||
_CALL_METHOD_DESCRIPTOR_FAST +
|
||||
_POP_TOP_OPARG +
|
||||
POP_TOP +
|
||||
_CHECK_PERIODIC_AT_END;
|
||||
|
||||
// Cache layout: counter/1, func_version/2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue