Skip to content
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

bpo-45923: Handle call events in bytecode #30364

Merged

Conversation

@markshannon
Copy link
Contributor

@markshannon markshannon commented Jan 3, 2022

This PR:

Adds a RESUME instruction which is a no-op unless tracing is active.
This replaces the current approach of testing for tracing on every call or resume.
In itself this has no real effect, but will enable faster dispatch and more streamlined tracing in the future.

No significant impact on performance

https://bugs.python.org/issue45923

@markshannon
Copy link
Contributor Author

@markshannon markshannon commented Jan 3, 2022

@lpereira
Copy link

@lpereira lpereira commented Jan 4, 2022

Ah, you did something I suggested a while back: instead of the START_FUNCTION opcode as you suggested a while back, you're doing this where you'd actually would jump to start_function. I'll go ahead and implement the quickening to NOP these too. The patch I wrote had also a new RETURN_VALUE_QUICK opcode that skipped some things if tracing was disabled. So I might combine the patches.

@markshannon markshannon requested a review from as a code owner Jan 4, 2022
@markshannon markshannon removed the request for review from Jan 4, 2022
@markshannon
Copy link
Contributor Author

@markshannon markshannon commented Jan 4, 2022

Might even be a bit faster although I suspect that is just random fluctuations.

Copy link
Member

@brandtbucher brandtbucher left a comment

Looks mostly good! I like the direction we're headed in with this stuff.

Just a few questions:

Python/ceval.c Show resolved Hide resolved
Python/compile.c Show resolved Hide resolved
Lib/test/test_compile.py Show resolved Hide resolved
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jan 6, 2022

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

And if you don't make the requested changes, you will be poked with soft cushions!

@markshannon
Copy link
Contributor Author

@markshannon markshannon commented Jan 6, 2022

Merging this now to get it into 3.11a4 and provide a fix/workaround for https://bugs.python.org/issue46225

@markshannon markshannon merged commit e028ae9 into python:main Jan 6, 2022
12 checks passed
@markshannon markshannon deleted the handle-call-events-in-bytecode branch Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants