simobject: Fix handling of parents for simobject vectors
Review Request #2065 - Created Oct. 17, 2013 and submitted
| Information | |
|---|---|
| Ali Saidi | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9871:9d72fd83da40 --------------------------- simobject: Fix handling of parents for simobject vectors SimObjectVector objects did not provide the same interface to the _parent attribute through get_parent() like a normal SimObject. It also handled assigning a _parent incorrectly if objects in a SimObjectVector were changed post-creation, leading to errors later when the simulator tried to execute. This patch fixes these two omissions.
Issue Summary
2
2
0
0
| Description | From | Last Updated | Status |
|---|---|---|---|
| Please add to this comment "because the elements in a SimObjectVector may not share the same parent" | Steve Reinhardt | Oct. 17, 2013, 5:17 p.m. | Open |
| Can you put a check in here and print a warning if the new item already has a parent and ... | Steve Reinhardt | Oct. 17, 2013, 5:17 p.m. | Open |
Posted (Oct. 17, 2013, 5:18 p.m.)
The semantics for SimObjectVectors and parenting have always been a little shaky around the edges, particularly when you start modifying them post-creation. I've wrestled with this before (see for example http://repo.gem5.org/gem5/rev/6efc3672733b and http://repo.gem5.org/gem5/rev/9f34cf472451). So while I doubt this change makes things really robust, it seems like a reasonable hack which makes things a little saner in some circumstances.
-
src/python/m5/SimObject.py (Diff revision 1) -
Please add to this comment "because the elements in a SimObjectVector may not share the same parent"
-
src/python/m5/params.py (Diff revision 1) -
Can you put a check in here and print a warning if the new item already has a parent and you're overwriting it? (See SimObject.add_child() for a similar warning.) It's not obvious you want to overwrite the parent of an already-parented object, but I would guess the common case you're addressing here is where the new object doesn't have a parent uyet.
