Nikos Nikoleris has submitted this change and it was merged. (
https://gem5-review.googlesource.com/5244 )
Change subject: mem: Use the caching in the AddrRangeMap class in
PhysicalMemory
......................................................................
mem: Use the caching in the AddrRangeMap class in PhysicalMemory
Use it instead of custom implemented caching.
Change-Id: Ie21012a77a3cb6ce57f34f879fa391678913896a
Reviewed-on: https://gem5-review.googlesource.com/5244
Reviewed-by: Daniel Carvalho <[email protected]>
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Nikos Nikoleris <[email protected]>
---
M src/mem/physical.cc
M src/mem/physical.hh
2 files changed, 9 insertions(+), 39 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved
Daniel Carvalho: Looks good to me, approved
Nikos Nikoleris: Looks good to me, approved
diff --git a/src/mem/physical.cc b/src/mem/physical.cc
index c7dbb3b..fdc88a8 100644
--- a/src/mem/physical.cc
+++ b/src/mem/physical.cc
@@ -74,8 +74,7 @@
PhysicalMemory::PhysicalMemory(const string& _name,
const vector<AbstractMemory*>& _memories,
bool mmap_using_noreserve) :
- _name(_name), rangeCache(addrMap.end()), size(0),
- mmapUsingNoReserve(mmap_using_noreserve)
+ _name(_name), size(0), mmapUsingNoReserve(mmap_using_noreserve)
{
if (mmap_using_noreserve)
warn("Not reserving swap space. May cause SIGSEGV on actual
usage\n");
@@ -236,20 +235,7 @@
bool
PhysicalMemory::isMemAddr(Addr addr) const
{
- // see if the address is within the last matched range
- if (rangeCache != addrMap.end() && rangeCache->first.contains(addr)) {
- return true;
- } else {
- // lookup in the interval tree
- const auto& r = addrMap.contains(addr);
- if (r == addrMap.end()) {
- // not in the cache, and not in the tree
- return false;
- }
- // the range is in the tree, update the cache
- rangeCache = r;
- return true;
- }
+ return addrMap.contains(addr) != addrMap.end();
}
AddrRangeList
@@ -293,15 +279,9 @@
{
assert(pkt->isRequest());
Addr addr = pkt->getAddr();
- if (rangeCache != addrMap.end() && rangeCache->first.contains(addr)) {
- rangeCache->second->access(pkt);
- } else {
- // do not update the cache here, as we typically call
- // isMemAddr before calling access
- const auto& m = addrMap.contains(addr);
- assert(m != addrMap.end());
- m->second->access(pkt);
- }
+ const auto& m = addrMap.contains(addr);
+ assert(m != addrMap.end());
+ m->second->access(pkt);
}
void
@@ -309,15 +289,9 @@
{
assert(pkt->isRequest());
Addr addr = pkt->getAddr();
- if (rangeCache != addrMap.end() && rangeCache->first.contains(addr)) {
- rangeCache->second->functionalAccess(pkt);
- } else {
- // do not update the cache here, as we typically call
- // isMemAddr before calling functionalAccess
- const auto& m = addrMap.contains(addr);
- assert(m != addrMap.end());
- m->second->functionalAccess(pkt);
- }
+ const auto& m = addrMap.contains(addr);
+ assert(m != addrMap.end());
+ m->second->functionalAccess(pkt);
}
void
diff --git a/src/mem/physical.hh b/src/mem/physical.hh
index cc733b2..3fb3510 100644
--- a/src/mem/physical.hh
+++ b/src/mem/physical.hh
@@ -118,11 +118,7 @@
std::string _name;
// Global address map
- AddrRangeMap<AbstractMemory*> addrMap;
-
- // a mutable cache for the last address map iterator that matched
- // an address
- mutable AddrRangeMap<AbstractMemory*>::const_iterator rangeCache;
+ AddrRangeMap<AbstractMemory*, 1> addrMap;
// All address-mapped memories
std::vector<AbstractMemory*> memories;
--
To view, visit https://gem5-review.googlesource.com/5244
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: Ie21012a77a3cb6ce57f34f879fa391678913896a
Gerrit-Change-Number: 5244
Gerrit-PatchSet: 6
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Assignee: Andreas Hansson <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-CC: Andreas Hansson <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev