Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-118095: Use broader specializations in tier 1, for better tier 2 support of calls.#118322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
markshannon merged 19 commits intopython:mainfromfaster-cpython:tier-2-call
May 4, 2024
Merged
Changes from1 commit
Commits
Show all changes
19 commits
Select commitHold shift + click to select a range
0b157ab
Add CALL_PY_GENERAL and CALL_BOUND_METHOD_GENERAL call specializations.
markshannonApr 26, 2024
2262f98
Add CALL_NON_PY_GENERAL call specialization
markshannonApr 26, 2024
4af43c2
Remove CALL_PY_WITH_DEFAULTS specialization
markshannonApr 26, 2024
b7795e3
Fix JIT build
markshannonApr 26, 2024
e5c7dce
Use CALL_NON_PY_GENERAL in more cases when otherwise failing to speci…
markshannonApr 30, 2024
61abb3b
Delete unused code
markshannonMay 2, 2024
b49bc86
Make sure that function version number is checked when tracing throug…
markshannonMay 3, 2024
f42519d
whitespace
markshannonMay 3, 2024
3294632
Merge branch 'main' into tier-2-call
markshannonMay 3, 2024
1a2dcfe
Check verion on function, not method
markshannonMay 3, 2024
62ff43c
Lower WASI C recursion limit again
markshannonMay 3, 2024
71c6d41
Get test passing on wasi
markshannonMay 3, 2024
0b40773
Lower WASI C recursion limit again
markshannonMay 3, 2024
02cdf2f
Yet another attempt to get the WASI build to work
markshannonMay 3, 2024
1831eb3
Skip test for WASI
markshannonMay 3, 2024
7819b1c
Skip another test for WASI
markshannonMay 3, 2024
857d152
Address some review comments
markshannonMay 4, 2024
839d16e
Use _SAVE_RETURN_OFFSET in general call instructions
markshannonMay 4, 2024
1d5c0a7
Merge branch 'main' into tier-2-call
markshannonMay 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Delete unused code
  • Loading branch information
@markshannon
markshannon committedMay 2, 2024
commit61abb3b1a1f5849746ed2f59e24ef0229cf1d524
74 changes: 0 additions & 74 deletionsPython/specialize.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1812,53 +1812,6 @@ specialize_class_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs)
return 0;
}

#ifdef Py_STATS
static int
builtin_call_fail_kind(int ml_flags)
{
switch (ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O |
METH_KEYWORDS | METH_METHOD)) {
case METH_VARARGS:
return SPEC_FAIL_CALL_CFUNC_VARARGS;
case METH_VARARGS | METH_KEYWORDS:
return SPEC_FAIL_CALL_CFUNC_VARARGS_KEYWORDS;
case METH_NOARGS:
return SPEC_FAIL_CALL_CFUNC_NOARGS;
case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
return SPEC_FAIL_CALL_CFUNC_METHOD_FASTCALL_KEYWORDS;
/* These cases should be optimized, but return "other" just in case */
case METH_O:
case METH_FASTCALL:
case METH_FASTCALL | METH_KEYWORDS:
return SPEC_FAIL_OTHER;
default:
return SPEC_FAIL_CALL_BAD_CALL_FLAGS;
}
}

static int
meth_descr_call_fail_kind(int ml_flags)
{
switch (ml_flags & (METH_VARARGS | METH_FASTCALL | METH_NOARGS | METH_O |
METH_KEYWORDS | METH_METHOD)) {
case METH_VARARGS:
return SPEC_FAIL_CALL_METH_DESCR_VARARGS;
case METH_VARARGS | METH_KEYWORDS:
return SPEC_FAIL_CALL_METH_DESCR_VARARGS_KEYWORDS;
case METH_METHOD | METH_FASTCALL | METH_KEYWORDS:
return SPEC_FAIL_CALL_METH_DESCR_METHOD_FASTCALL_KEYWORDS;
/* These cases should be optimized, but return "other" just in case */
case METH_NOARGS:
case METH_O:
case METH_FASTCALL:
case METH_FASTCALL | METH_KEYWORDS:
return SPEC_FAIL_OTHER;
default:
return SPEC_FAIL_CALL_BAD_CALL_FLAGS;
}
}
#endif // Py_STATS

static int
specialize_method_descriptor(PyMethodDescrObject *descr, _Py_CODEUNIT *instr,
int nargs)
Expand DownExpand Up@@ -1985,33 +1938,6 @@ specialize_c_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs)
}
}

#ifdef Py_STATS
static int
call_fail_kind(PyObject *callable)
{
assert(!PyCFunction_CheckExact(callable));
assert(!PyFunction_Check(callable));
assert(!PyType_Check(callable));
assert(!Py_IS_TYPE(callable, &PyMethodDescr_Type));
assert(!PyMethod_Check(callable));
if (PyInstanceMethod_Check(callable)) {
return SPEC_FAIL_CALL_INSTANCE_METHOD;
}
// builtin method
else if (PyCMethod_Check(callable)) {
return SPEC_FAIL_CALL_CMETHOD;
}
else if (Py_TYPE(callable) == &PyWrapperDescr_Type) {
return SPEC_FAIL_CALL_OPERATOR_WRAPPER;
}
else if (Py_TYPE(callable) == &_PyMethodWrapper_Type) {
return SPEC_FAIL_CALL_METHOD_WRAPPER;
}
return SPEC_FAIL_OTHER;
}
#endif // Py_STATS


void
_Py_Specialize_Call(PyObject *callable, _Py_CODEUNIT *instr, int nargs)
Copy link
Member

@brandtbucherbrandtbucherMay 3, 2024
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is really cool. Am I correct that we are now (in theory) able to specialize all calls, except for those where:

  • We're out of versions somewhere.
  • The call itself is invalid.

And even thesecan be specialized, even if it doesn't make a whole lot of sense.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes, more or less. There might be a few other cases, but they are all very rare.

{
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp