base: Encapsulate the underlying fields in AddrRange
Review Request #1524 - Created Oct. 30, 2012 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 9325:dd82368c5370 --------------------------- base: Encapsulate the underlying fields in AddrRange This patch makes the start and end address private in a move to prevent direct manipulation and matching of ranges based on these fields. This is done so that a transition to ranges with interleaving support is possible. As a result of hiding the start and end, a number of member functions are needed to perform the comparisons and manipulations that previously took place directly on the members. An accessor function is provided for the start address, and functions are added to merge two ranges, and test if an address is within a range. As a result of the latter the != and == operator is also removed in favour of the member function. A member function that returns a string representation is also created to allow debug printing. In general, this patch does not add any functionality, but it does take us closer to a situation where interleaving (and more cleverness) can be added under the bonnet without exposing it to the user. More on that in a later patch.
util/regress all passing (disregarding t1000 and eio)
Posted (Oct. 31, 2012, 1:23 a.m.)
-
src/base/addr_range.hh (Diff revision 1) -
Thanks for doing this. I certainly believe that this increases the readability of the code. Just one comment. I would prefer range.containsAddr(addr) compared to range.inRange(addr) as the later sounds as if we are testing if the addr contains the range. But I'll let you make that choice.
Posted (Oct. 31, 2012, 1:38 a.m.)
-
src/base/addr_range.hh (Diff revision 1) -
Can we square brackets around the arguments, like the usual mathematical notation?
-
src/base/addr_range.hh (Diff revision 1) -
Why this change in defintion of intersection? In fact, even the original definition was incorrect.
Review request changed
Updated (Oct. 31, 2012, 6:46 p.m.)
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+133 -91) |
Ship It!
