Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/4842 )

Change subject: sim: Check the SimObjectVector.has_parent function to use the "any" function.
......................................................................

sim: Check the SimObjectVector.has_parent function to use the "any" function.

The existing code was essentially doing the same thing, but in a more
roundabout and obscure way. One difference between the two versions is that
I believe this will stop as soon as it encounters an element without a
parent, where the original version would call has_parent() on all the
elements regardless.

Change-Id: Ia1fef3083fc88fca11f8ecfca453476e33194695
Reviewed-on: https://gem5-review.googlesource.com/4842
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/python/m5/params.py
1 file changed, 1 insertion(+), 2 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Gabe Black: Looks good to me, approved



diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index e5f47e6..7a28e63 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -270,8 +270,7 @@
                 v.set_parent(parent, "%s%0*d" % (name, width, i))

     def has_parent(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 any([e.has_parent() for e in self if not isNullPointer(e)])

     # return 'cpu0 cpu1' etc. for print_ini()
     def get_name(self):

--
To view, visit https://gem5-review.googlesource.com/4842
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1fef3083fc88fca11f8ecfca453476e33194695
Gerrit-Change-Number: 4842
Gerrit-PatchSet: 3
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to