-
Notifications
You must be signed in to change notification settings - Fork 51
Quickening interpreter #27
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
Comments
Agreed. However, I'd like to expose this (in some read-only form) to the Python API so that |
At some point this will require fixing up jump targets. |
The same is true for Python tracing/profiling, right?
❤️ |
No. Jump targets will remain the same. That's one of the reasons for not changing the bytecode format. |
No, Python tracing/profiling is really expensive. The additional cost to add a breakpoint may be zero, but the total cost is large. |
Dumping the quickened code in some form might be useful for debugging, but I think that collecting stats is more useful. Adding it to |
BTW Google has some really ugly hacks for inserting breakpoints into byte/wordcode of unmodified CPythons in google-python-cloud-debugger, would be super to have the same thing officially in the CPython API. |
This is a simple idea, but very powerful.
Once a code object has been executed a few times, say 8, create a new bytecode array for the instructions.
The new array is not exposed to the rest of the VM and definitely not to the C or Python APIs.
Because it is private, it can be freely modified at runtime, which allows a number of really nice features:
dis
.use_tracing
when it is known that tracing is off.LOAD_FAST
,STORE_FAST
,LOAD_CONST
,POP_TOP
, as they account for approx 45% of all instructions.The quickened bytecode should have the same 2 byte format as normal bytecode.
That way only one interpreter is required and it avoids the complexity of switching between interpreters.
The text was updated successfully, but these errors were encountered: