Commit 3d9a8393 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Have to clear runtime ics more fully when destructed

parent 06dd454c
...@@ -78,10 +78,13 @@ void ICSlotInfo::clear(bool should_invalidate) { ...@@ -78,10 +78,13 @@ void ICSlotInfo::clear(bool should_invalidate) {
ic->invalidate(this); ic->invalidate(this);
used = false; used = false;
for (auto p : gc_references) { // Have to be careful here: DECREF can end up recursively clearing this slot
std::vector<void*> saved_gc_references;
std::swap(saved_gc_references, gc_references);
for (auto p : saved_gc_references) {
Py_DECREF(p); Py_DECREF(p);
} }
gc_references.clear(); saved_gc_references.clear();
for (auto&& invalidator : invalidators) { for (auto&& invalidator : invalidators) {
invalidator->remove(this); invalidator->remove(this);
...@@ -353,10 +356,8 @@ ICInfo::~ICInfo() { ...@@ -353,10 +356,8 @@ ICInfo::~ICInfo() {
deregisterGCTrackedICInfo(this); deregisterGCTrackedICInfo(this);
for (auto& slot : slots) { for (auto& slot : slots) {
for (auto invalidator : slot.invalidators) { // Calling a full clear() might be overkill here, but probably better safe than sorry:
assert(invalidator->dependents.count(&slot)); slot.clear(false);
invalidator->dependents.erase(&slot);
}
} }
} }
......
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