-
Notifications
You must be signed in to change notification settings - Fork 52
Compact code object marshaled form and pre-quicken bytecode when unmarshaling #462
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
Presumably the same idea would apply to deep-frozen code objects? |
I see loading marshalled code as equivalent to compiling it. So if we want unmarshalling to put the adaptive bytecodes in, we should do the same for the compiler -- IOW we should quicken everything immediately. Unmarshalling results in exactly the same tree of code objects (module -> classes -> methods etc.) and compiling. |
Yes, it is the same, provided that [un]marshaling handles the bytecode as an array of code units which it compresses, not just an array of bytes. |
Was this in response to Eric's question about deepfreeze, or mine about unmarshal vs. compiler? |
Yours. |
But we need to change marshaling first, so that it understands that code is made up of 16bit code units, not just bytes. |
To marshal a code object, we get the bytecode as a bytes object by calling (Likely we would design a new, slightly different API, but my point is that we can implement and test the bytecode compression first, and then using it from marshal.c would be straightforward.) |
Obsolete. See #566 |
Currently we go through a two stage process to get to the adaptive form of instructions.
The explanation below uses
CALL
, but it applies to all specializable instructions.CALL, oparg, 0, 0, 0 ...
where the zeros are the cache.CALL
s withCALL_ADAPTIVE
s.Instead we should quicken when unmarshaling, so that we create:
instead of
The marshaled form only needs one byte for instructions without an oparg and two for other instructions. No space is needed for the cache.
The text was updated successfully, but these errors were encountered: