mem: clean up write buffer check in Cache::handleSnoop()

The 'if (writebacks.size)' check was redundant, because
writeBuffer.findMatches() would return false if the
writebacks list was empty.

Also renamed 'mshr' to 'wb_entry' in this context since
we are pointing at a writebuffer entry and not an MSHR
(even though it's the same C++ class).
This commit is contained in:
Steve Reinhardt 2015-03-14 06:51:07 -07:00
parent 7902e5778f
commit ccef61d1cc

View file

@ -12,7 +12,7 @@
* modified or unmodified, in source code or in binary form.
*
* Copyright (c) 2002-2005 The Regents of The University of Michigan
* Copyright (c) 2010 Advanced Micro Devices, Inc.
* Copyright (c) 2010,2015 Advanced Micro Devices, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -1818,14 +1818,13 @@ Cache<TagStore>::recvTimingSnoopReq(PacketPtr pkt)
DPRINTF(Cache, "Snoop hit in writeback to addr %#llx (%s)\n",
pkt->getAddr(), is_secure ? "s" : "ns");
//Look through writebacks for any non-uncachable writes, use that
if (writebacks.size()) {
// Look through writebacks for any cachable writes.
// We should only ever find a single match
assert(writebacks.size() == 1);
mshr = writebacks[0];
assert(!mshr->isUncacheable());
assert(mshr->getNumTargets() == 1);
PacketPtr wb_pkt = mshr->getTarget()->pkt;
MSHR *wb_entry = writebacks[0];
assert(!wb_entry->isUncacheable());
assert(wb_entry->getNumTargets() == 1);
PacketPtr wb_pkt = wb_entry->getTarget()->pkt;
assert(wb_pkt->cmd == MemCmd::Writeback);
assert(!pkt->memInhibitAsserted());
@ -1845,10 +1844,9 @@ Cache<TagStore>::recvTimingSnoopReq(PacketPtr pkt)
if (pkt->isInvalidate()) {
// Invalidation trumps our writeback... discard here
markInService(mshr, false);
markInService(wb_entry, false);
delete wb_pkt;
}
} // writebacks.size()
}
// If this was a shared writeback, there may still be