changeset 0742b0ccc430 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=0742b0ccc430
description:
        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:

 src/mem/cache/cache_impl.hh |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (38 lines):

diff -r 9fd974959aa3 -r 0742b0ccc430 src/mem/cache/cache_impl.hh
--- a/src/mem/cache/cache_impl.hh       Thu Jun 27 05:49:49 2013 -0400
+++ b/src/mem/cache/cache_impl.hh       Thu Jun 27 05:49:49 2013 -0400
@@ -1655,23 +1655,22 @@
             // 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);
+            // 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);
+            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());
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to