Skip to content

bpo-44525: Specialize CALL_FUNCTION for C function calls #26934

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Oct 19, 2021
Merged
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5e73b74
WIP: Specialize CALL_FUNCTION for builtins
Fidget-Spinner Jun 26, 2021
1539105
fix some GCC compilation warnings
Fidget-Spinner Jun 26, 2021
68e5451
hopefully fix the segfaults
Fidget-Spinner Jun 26, 2021
1d841b0
Rename to CALL_CFUNCTION and generalize to all c functions
Fidget-Spinner Jun 27, 2021
f41b623
fix formatting, remove redundant check
Fidget-Spinner Jun 27, 2021
de520bd
goto fail rather than return -1
Fidget-Spinner Jun 28, 2021
0e0a3a4
Create 2021-06-28-22-23-59.bpo-44525.sSvUKG.rst
Fidget-Spinner Jun 28, 2021
65de42d
Apply easier suggestions from Mark's review
Fidget-Spinner Jun 29, 2021
685557f
Only specialize METH_FASTCALL and METH_O
Fidget-Spinner Jun 30, 2021
5baa936
Update 2021-06-28-22-23-59.bpo-44525.sSvUKG.rst
Fidget-Spinner Jun 30, 2021
bc69360
turn off specialization stats flag
Fidget-Spinner Jun 30, 2021
8671a60
Apply suggestions by Mark
Fidget-Spinner Jul 3, 2021
a8b8b4f
reduce diff
Fidget-Spinner Jul 3, 2021
736d9af
use PyMapping_HasKeyString since PyDict_GetItemString is discouraged
Fidget-Spinner Jul 3, 2021
2e3195d
fix reference leak
Fidget-Spinner Jul 3, 2021
d8b3a09
remove unused variable, add more specialization fails
Fidget-Spinner Jul 3, 2021
25b002c
don't allow specialized function calls when tracing
Fidget-Spinner Jul 3, 2021
557e4bc
deopt when tracing
Fidget-Spinner Jul 3, 2021
e554d64
Merge remote-tracking branch 'upstream/main' into call_function_speci…
Fidget-Spinner Jul 8, 2021
ea0d432
apply mark's comments
Fidget-Spinner Jul 8, 2021
97749b7
change deopts to asserts
Fidget-Spinner Jul 8, 2021
feb966a
add blank lines between each case
Fidget-Spinner Jul 13, 2021
9a5a407
Remove CALL_CFUNCTION_FAST
Fidget-Spinner Jul 13, 2021
4dafd8d
Apply Mark's suggestions
Fidget-Spinner Jul 14, 2021
84d2367
delete useless comment, add back useful one
Fidget-Spinner Jul 14, 2021
12a5333
remove complicated checks for classes
Fidget-Spinner Jul 14, 2021
b99f65c
apply suggestions by Mark
Fidget-Spinner Jul 15, 2021
5239342
actually move it into the block this time
Fidget-Spinner Jul 15, 2021
c4d6ca3
Merge remote-tracking branch 'upstream/main' into call_function_speci…
Fidget-Spinner Jul 15, 2021
7250329
Regen opcodes
Fidget-Spinner Jul 15, 2021
c649070
move type earlier
Fidget-Spinner Jul 15, 2021
5dfce16
change to assert
Fidget-Spinner Jul 16, 2021
0da5ed2
increment unquickened stats
Fidget-Spinner Jul 16, 2021
40b919f
Re-add CALL_FUNCTION_BUILTIN_FAST
Fidget-Spinner Jul 16, 2021
75e3540
add check for C methods
Fidget-Spinner Jul 16, 2021
3e2766c
Merge remote-tracking branch 'upstream/main' into call_function_speci…
Fidget-Spinner Jul 27, 2021
c06f5b8
Merge remote-tracking branch 'upstream/main' into call_function_speci…
Fidget-Spinner Sep 15, 2021
3c1129a
fix build errors
Fidget-Spinner Sep 15, 2021
226c591
Add CALL_FUNCTION_LEN
Fidget-Spinner Sep 17, 2021
2dc2738
add CALL_FUNCTION_ISINSTANCE
Fidget-Spinner Sep 17, 2021
7bd4338
fix specialization stats
Fidget-Spinner Sep 17, 2021
e2aada7
Merge remote-tracking branch 'upstream/main' into call_function_speci…
Fidget-Spinner Sep 17, 2021
f8c0957
Merge remote-tracking branch 'upstream/main' into call_function_speci…
Fidget-Spinner Oct 18, 2021
2500ab6
Refactor
Fidget-Spinner Oct 18, 2021
08ef4d8
convert to static
Fidget-Spinner Oct 18, 2021
41f6fa6
fix news and formatting
Fidget-Spinner Oct 18, 2021
8b113d1
remove typo
Fidget-Spinner Oct 18, 2021
9642df5
remove nit
Fidget-Spinner Oct 18, 2021
8a74cff
fix wrong return code
Fidget-Spinner Oct 18, 2021
907c5cb
partly address code review
Fidget-Spinner Oct 18, 2021
3e09485
Exclude function if not collecting stats
Fidget-Spinner Oct 19, 2021
b28d85c
check for error first
Fidget-Spinner Oct 19, 2021
617424b
Record cache hit earlier
Fidget-Spinner Oct 19, 2021
e73b69f
fix isinstance bug
Fidget-Spinner Oct 19, 2021
f191720
apply suggestions from review: move up cache hits
Fidget-Spinner Oct 19, 2021
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
Prev Previous commit
Next Next commit
convert to static
  • Loading branch information
Fidget-Spinner committed Oct 18, 2021
commit 08ef4d82b0a6e86c96868b9f51a347e1273de2f7
4 changes: 2 additions & 2 deletions Python/specialize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ _Py_Specialize_BinaryMultiply(PyObject *left, PyObject *right, _Py_CODEUNIT *ins
}


int
static int
specialize_c_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
SpecializedCacheEntry *cache, PyObject *builtins)
{
Expand Down Expand Up @@ -1307,7 +1307,7 @@ specialize_c_call(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
}

#if COLLECT_SPECIALIZATION_STATS_DETAILED
int
static int
c_call_fail_kind(PyObject *callable)
{
/* These might be implemented in the future. Collecting stats for now. */
Expand Down