From c02dc074248717ad6dd6f397f5124f97094f7a20 Mon Sep 17 00:00:00 2001 From: Ali Saidi Date: Thu, 10 May 2012 18:04:27 -0500 Subject: Cache: restructure code that actually isn't a loop --- src/mem/cache/cache_impl.hh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/mem/cache/cache_impl.hh') diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 3312fc941..d9e06c022 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -1294,8 +1294,10 @@ Cache::snoopTiming(PacketPtr pkt) pkt->getAddr()); //Look through writebacks for any non-uncachable writes, use that - for (int i = 0; i < writebacks.size(); i++) { - mshr = writebacks[i]; + if (writebacks.size()) { + // 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; @@ -1321,16 +1323,14 @@ Cache::snoopTiming(PacketPtr pkt) markInService(mshr); delete wb_pkt; } - - // If this was a shared writeback, there may still be - // other shared copies above that require invalidation. - // We could be more selective and return here if the - // request is non-exclusive or if the writeback is - // exclusive. - break; - } + } // writebacks.size() } + // If this was a shared writeback, there may still be + // other shared copies above that require invalidation. + // We could be more selective and return here if the + // request is non-exclusive or if the writeback is + // exclusive. handleSnoop(pkt, blk, true, false, false); } -- cgit v1.2.3