-
Notifications
You must be signed in to change notification settings - Fork 289
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
transform BST to gapless bytecode inplace #1391
Conversation
- all instructions of the CFG are directly emitted a single memory region - all instructions are packed and follow each other directly - the CFGBlock just stores the offset into the bytecode where the first instruction of the block is located - invokes are only a bit in the opcode field which when set means that the pointers to the normal and exc CFGBlocks* directly follow the normal instruction
…BST_ClassDef nodes
memory improvements are:
|
this also improves max rss for: s = """
class C(object):
def f(self):
return 'lalala'
C().f()
"""
for i in xrange(50000):
exec s from 124MB to 38MB. |
@@ -4054,6 +4055,8 @@ void CodeConstants::dealloc() const { | |||
owned_refs.clear(); | |||
for (auto&& e : funcs_and_classes) { | |||
Py_DECREF(e.second); | |||
assert(e.first->type() == BST_TYPE::FunctionDef || e.first->type() == BST_TYPE::ClassDef); | |||
delete[] e.first; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be just delete
?
this simplifies the code and removes a lot of ugliness
I fixed the |
lgtm! |
this is a modified version of #1381 which creates the bytecode in-place and does not evolve duplicating some CFG structures.
CFGBlocks*
directly follow the normal instruction