Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/12035
Change subject: systemc: Make orphans top level objects instead of
panic-ing.
......................................................................
systemc: Make orphans top level objects instead of panic-ing.
When a simulation ends, the sc_objects it contains are destroyed one
by one, not necessarily in hierarchy order. That means that a parent
object can legitimately be destroyed before its children. Instead of
panic-ing when that inevitably happens, this change makes gem5 turn
those children into top level objects.
Change-Id: Icad9c99310fbc3ddcadbbb4f8a990b4fbfe35bdf
---
M src/systemc/core/object.cc
M src/systemc/core/object.hh
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/systemc/core/object.cc b/src/systemc/core/object.cc
index 68c52eb..39403ca 100644
--- a/src/systemc/core/object.cc
+++ b/src/systemc/core/object.cc
@@ -118,7 +118,12 @@
Object::~Object()
{
- panic_if(!children.empty(), "Parent object still has children.\n");
+ // Promote all children to be top level objects.
+ for (auto child: children) {
+ addObject(&topLevelObjects, child);
+ child->_gem5_object->parent = nullptr;
+ }
+ children.clear();
if (parent)
popObject(&parent->_gem5_object->children, _name);
diff --git a/src/systemc/core/object.hh b/src/systemc/core/object.hh
index 1317986..c87a98b 100644
--- a/src/systemc/core/object.hh
+++ b/src/systemc/core/object.hh
@@ -99,7 +99,6 @@
Objects children;
Events events;
sc_core::sc_object *parent;
- ObjectsIt parentIt;
sc_core::sc_attr_cltn cltn;
};
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12035
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Icad9c99310fbc3ddcadbbb4f8a990b4fbfe35bdf
Gerrit-Change-Number: 12035
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev