mirror of
https://github.com/python/cpython.git
synced 2026-04-15 08:11:10 +00:00
gh-131798: JIT inline function addresses of builtin methods (#146906)
This commit is contained in:
parent
b8470deb5d
commit
7e275d4965
11 changed files with 1724 additions and 1282 deletions
|
|
@ -1394,6 +1394,39 @@ dummy_func(void) {
|
|||
}
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_NOARGS, (callable, self_or_null, args[oparg] -- res)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_NOARGS_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, (callable, self_or_null, args[oparg] -- res)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- res)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_FAST_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
}
|
||||
|
||||
op(_GUARD_CALLABLE_METHOD_DESCRIPTOR_FAST, (callable, self_or_null, args[oparg] -- callable, self_or_null, args[oparg])) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && sym_matches_type(callable, &PyMethodDescr_Type)) {
|
||||
|
|
@ -1420,6 +1453,13 @@ dummy_func(void) {
|
|||
}
|
||||
|
||||
op(_CALL_METHOD_DESCRIPTOR_O, (callable, self_or_null, args[oparg] -- res, c, s, a)) {
|
||||
PyObject *callable_o = sym_get_const(ctx, callable);
|
||||
if (callable_o && Py_IS_TYPE(callable_o, &PyMethodDescr_Type)
|
||||
&& sym_is_not_null(self_or_null)) {
|
||||
PyMethodDescrObject *method = (PyMethodDescrObject *)callable_o;
|
||||
PyCFunction cfunc = method->d_method->ml_meth;
|
||||
ADD_OP(_CALL_METHOD_DESCRIPTOR_O_INLINE, oparg + 1, (uintptr_t)cfunc);
|
||||
}
|
||||
res = sym_new_not_null(ctx);
|
||||
c = callable;
|
||||
if (sym_is_not_null(self_or_null)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue