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.
This commit is contained in:
parent
9a1169f3d7
commit
f330b3c28d
1 changed files with 11 additions and 12 deletions
23
src/mem/cache/cache_impl.hh
vendored
23
src/mem/cache/cache_impl.hh
vendored
|
@ -1655,23 +1655,22 @@ Cache<TagStore>::getTimingPacket()
|
||||||
// that, and then we'll have to figure out what to do.
|
// that, and then we'll have to figure out what to do.
|
||||||
assert(blk == NULL);
|
assert(blk == NULL);
|
||||||
|
|
||||||
// We need to check the caches above us to verify that they don't have
|
// We need to check the caches above us to verify that
|
||||||
// a copy of this block in the dirty state at the moment. Without this
|
// they don't have a copy of this block in the dirty state
|
||||||
// check we could get a stale copy from memory that might get used
|
// at the moment. Without this check we could get a stale
|
||||||
// in place of the dirty one.
|
// copy from memory that might get used in place of the
|
||||||
PacketPtr snoop_pkt = new Packet(tgt_pkt, true);
|
// dirty one.
|
||||||
snoop_pkt->setExpressSnoop();
|
Packet snoop_pkt(tgt_pkt, true);
|
||||||
snoop_pkt->senderState = mshr;
|
snoop_pkt.setExpressSnoop();
|
||||||
cpuSidePort->sendTimingSnoopReq(snoop_pkt);
|
snoop_pkt.senderState = mshr;
|
||||||
|
cpuSidePort->sendTimingSnoopReq(&snoop_pkt);
|
||||||
|
|
||||||
if (snoop_pkt->memInhibitAsserted()) {
|
if (snoop_pkt.memInhibitAsserted()) {
|
||||||
markInService(mshr, snoop_pkt);
|
markInService(mshr, &snoop_pkt);
|
||||||
DPRINTF(Cache, "Upward snoop of prefetch for addr %#x hit\n",
|
DPRINTF(Cache, "Upward snoop of prefetch for addr %#x hit\n",
|
||||||
tgt_pkt->getAddr());
|
tgt_pkt->getAddr());
|
||||||
delete snoop_pkt;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
delete snoop_pkt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt = getBusPacket(tgt_pkt, blk, mshr->needsExclusive());
|
pkt = getBusPacket(tgt_pkt, blk, mshr->needsExclusive());
|
||||||
|
|
Loading…
Reference in a new issue