Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/4841
Change subject: sim: Only consider non-NULL elements in
SimObjectVector.has_parent.
......................................................................
sim: Only consider non-NULL elements in SimObjectVector.has_parent.
NullSimObject doesn't have a has_parent function, and it's not clear what
its
return value should be if one were added. The appropriate value seems to
depend on why some other bit of code is checking if there's a parent in the
first place.
In SimObjectVector, the has_parent function is checking whether all of its
elements have a parent. In this particular case, the most reasonable thing
to do seems to be to just skip those elements.
Change-Id: I5f8cad66d1b22c5e37962492fd77cff9371e5af8
---
M src/python/m5/params.py
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index b49f811..e5f47e6 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -270,7 +270,8 @@
v.set_parent(parent, "%s%0*d" % (name, width, i))
def has_parent(self):
- return reduce(lambda x,y: x and y, [v.has_parent() for v in self])
+ elements = [e for e in self if not isNullPointer(e)]
+ return reduce(lambda x,y: x and y, [v.has_parent() for v in
elements])
# return 'cpu0 cpu1' etc. for print_ini()
def get_name(self):
--
To view, visit https://gem5-review.googlesource.com/4841
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f8cad66d1b22c5e37962492fd77cff9371e5af8
Gerrit-Change-Number: 4841
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev