summaryrefslogtreecommitdiff
path: root/src/mem
diff options
context:
space:
mode:
authorAli Saidi <Ali.Saidi@ARM.com>2012-05-10 18:04:27 -0500
committerAli Saidi <Ali.Saidi@ARM.com>2012-05-10 18:04:27 -0500
commit4f66bcdd2e2cf983f66fe745eaa27698e90d0d60 (patch)
treec4efa628413252b7bad0188db83af6096ae2a1e8 /src/mem
parent5ecaf30219d8a846f2747d4d67503c21c6e13333 (diff)
downloadgem5-4f66bcdd2e2cf983f66fe745eaa27698e90d0d60.tar.xz
gem5: fix some iterator use and erase bugs
Diffstat (limited to 'src/mem')
-rw-r--r--src/mem/cache/prefetch/base.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mem/cache/prefetch/base.cc b/src/mem/cache/prefetch/base.cc
index 4d1f7c81c..f3ac5f046 100644
--- a/src/mem/cache/prefetch/base.cc
+++ b/src/mem/cache/prefetch/base.cc
@@ -182,7 +182,7 @@ BasePrefetcher::notify(PacketPtr &pkt, Tick time)
pfRemovedMSHR++;
delete (*iter)->req;
delete (*iter);
- pf.erase(iter);
+ iter = pf.erase(iter);
if (pf.empty())
cache->deassertMemSideBusRequest(BaseCache::Request_PF);
}
@@ -194,15 +194,17 @@ BasePrefetcher::notify(PacketPtr &pkt, Tick time)
// Needed for serial calculators like GHB
if (serialSquash) {
iter = pf.end();
- iter--;
+ if (iter != pf.begin())
+ iter--;
while (!pf.empty() && ((*iter)->time >= time)) {
pfSquashed++;
DPRINTF(HWPrefetch, "Squashing old prefetch addr: 0x%x\n",
(*iter)->getAddr());
delete (*iter)->req;
delete (*iter);
- pf.erase(iter);
- iter--;
+ iter = pf.erase(iter);
+ if (iter != pf.begin())
+ iter--;
}
if (pf.empty())
cache->deassertMemSideBusRequest(BaseCache::Request_PF);