Tom Rollet has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/51647 )
Change subject: python: remove SimObject children on NULL assignment
......................................................................
python: remove SimObject children on NULL assignment
Before this commit, on assigning NULL to an 'attr' that is a SimObject,
the corresponding children SimObject was not set to NULL.
This makes some SimObject being initialized in the c++ world
even if they are not needed.
This commit set the children to NULL in that case.
Change-Id: I2030d9d1b80c020fa28e50c0eca4f87b756763d6
---
M src/python/m5/SimObject.py
1 file changed, 23 insertions(+), 0 deletions(-)
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index d18d879..749066a 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1443,6 +1443,12 @@
e.args = (msg, )
raise
self._values[attr] = value
+
+ # If we assign NULL to an attr that is a SimOnject,
+ # remove the corresponding children
+ if attr in self._children and isNullPointer(value):
+ self.clear_child(attr)
+
# implicitly parent unparented objects assigned as params
if isSimObjectOrVector(value) and not value.has_parent():
self.add_child(attr, value)
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51647
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2030d9d1b80c020fa28e50c0eca4f87b756763d6
Gerrit-Change-Number: 51647
Gerrit-PatchSet: 1
Gerrit-Owner: Tom Rollet <[email protected]>
Gerrit-CC: Nathanael Premillieu <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s