Commit 7f52a9ad authored by Marius Wachtler's avatar Marius Wachtler

code object: call destructor and free bjit code

parent 21ac70f4
...@@ -694,6 +694,9 @@ void BoxedCode::addVersion(void* f, ConcreteCompilerType* rtn_type, const std::v ...@@ -694,6 +694,9 @@ void BoxedCode::addVersion(void* f, ConcreteCompilerType* rtn_type, const std::v
} }
bool BoxedCode::tryDeallocatingTheBJitCode() { bool BoxedCode::tryDeallocatingTheBJitCode() {
if (code_blocks.empty())
return true;
// we can only delete the code object if we are not executing it currently // we can only delete the code object if we are not executing it currently
assert(bjit_num_inside >= 0); assert(bjit_num_inside >= 0);
if (bjit_num_inside != 0) { if (bjit_num_inside != 0) {
......
...@@ -107,7 +107,9 @@ void BoxedCode::dealloc(Box* b) noexcept { ...@@ -107,7 +107,9 @@ void BoxedCode::dealloc(Box* b) noexcept {
Py_XDECREF(o->name); Py_XDECREF(o->name);
Py_XDECREF(o->_doc); Py_XDECREF(o->_doc);
o->tryDeallocatingTheBJitCode();
o->source.reset(nullptr); o->source.reset(nullptr);
o->~BoxedCode();
o->cls->tp_free(o); o->cls->tp_free(o);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment