-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
DRAFT: limited call inlining #116257
DRAFT: limited call inlining #116257
Conversation
So here's one case. We have a trace that initially contains this sequence:
Note the After abstract interpretation it looks like this (I think that's unchanged -- still 47-70):
Then my call inliner goes to work, and then the peepholer (last). The final optimized code now has this sequence:
Note that at 51 we have All in all it looks like I should integrate this with the abstract interpreter, but I don't think I'll have time this weekend. |
In my call inlining design, I have one pass before the abstract interpreter that marks the leaf frames as inlineable, (see Also, how do you ensure I know technically there won't be segfault because you still have |
Do you mind if I take your stuff and merge it into mine, then send both our work combined as a PR? Some stuff that the other branch has that this PR doesn't have yet:
Your PR has more tests, and is closer to what we want for 3.13. So I can merge both approaches and get something that works for more cases than just |
Sure, go ahead. |
Closing in favor of gh-116290. |
Hey @Fidget-Spinner, I had a rainy day, so here's a very crude implementation of my idea for call inlining without frame reconstruction (only for some very limited cases). I learned a bunch of stuff -- our call sequence is rather verbose, and there are rare cases where
self_of_null
may unexpectedly be non-NULL.I hit an example of the latter, which crashed before I added
_GUARD_NOT_METHOD
as a hack, but something there feels shady. (I think this is the case where the abstract interpreter the checkif (sym_is_null(self_or_null) || sym_is_not_null(self_or_null))
in the code block for_INIT_CALL_PY_EXACT_ARGS
doesn't succeed. Maybe I should move the inlining code into the abstract interpreter, so it can use this same check?)Anyway, what do you think?