diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2013-06-27 05:49:49 -0400 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2013-06-27 05:49:49 -0400 |
commit | f330b3c28d489d28743f2c31b607d33036b37006 (patch) | |
tree | c6c316fead531de03b0903b80ffa6632f9f426e3 /src/mem/cache/cache_impl.hh | |
parent | 9a1169f3d7d062f06ca826458d350b6e7edf5caa (diff) | |
download | gem5-f330b3c28d489d28743f2c31b607d33036b37006.tar.xz |
mem: Remove a redundant heap allocation for a snoop packet
This patch changes the updards snoop packet to avoid allocating and
later deleting it. As the code executes in 0 time and the lifetime of
the packet does not extend beyond the block there is no reason to heap
allocate it.
Diffstat (limited to 'src/mem/cache/cache_impl.hh')
-rw-r--r-- | src/mem/cache/cache_impl.hh | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 3ebb4eb70..60b72b521 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -1655,23 +1655,22 @@ Cache<TagStore>::getTimingPacket() // that, and then we'll have to figure out what to do. assert(blk == NULL); - // We need to check the caches above us to verify that they don't have - // a copy of this block in the dirty state at the moment. Without this - // check we could get a stale copy from memory that might get used - // in place of the dirty one. - PacketPtr snoop_pkt = new Packet(tgt_pkt, true); - snoop_pkt->setExpressSnoop(); - snoop_pkt->senderState = mshr; - cpuSidePort->sendTimingSnoopReq(snoop_pkt); - - if (snoop_pkt->memInhibitAsserted()) { - markInService(mshr, snoop_pkt); + // We need to check the caches above us to verify that + // they don't have a copy of this block in the dirty state + // at the moment. Without this check we could get a stale + // copy from memory that might get used in place of the + // dirty one. + Packet snoop_pkt(tgt_pkt, true); + snoop_pkt.setExpressSnoop(); + snoop_pkt.senderState = mshr; + cpuSidePort->sendTimingSnoopReq(&snoop_pkt); + + if (snoop_pkt.memInhibitAsserted()) { + markInService(mshr, &snoop_pkt); DPRINTF(Cache, "Upward snoop of prefetch for addr %#x hit\n", tgt_pkt->getAddr()); - delete snoop_pkt; return NULL; } - delete snoop_pkt; } pkt = getBusPacket(tgt_pkt, blk, mshr->needsExclusive()); |