Ruby: Remove isTagPresent() calls from Sequencer.cc
authorNilay Vaish <nilay@cs.wisc.edu>
Fri, 10 Feb 2012 17:29:02 +0000 (11:29 -0600)
committerNilay Vaish <nilay@cs.wisc.edu>
Fri, 10 Feb 2012 17:29:02 +0000 (11:29 -0600)
This patch removes the calls to isTagPresent() from Sequencer.cc. These
calls are made just for setting the cache block to have been most recently
used. The calls have been folded in to the function setMRU().

src/mem/ruby/system/CacheMemory.cc
src/mem/ruby/system/Sequencer.cc

index 9f1fe632087dcafc24c22668349732b61313ddad..393612355ab3279c02fb57d5db33d2c88927b9ed 100644 (file)
@@ -339,12 +339,12 @@ CacheMemory::lookup(const Address& address) const
 void
 CacheMemory::setMRU(const Address& address)
 {
-    Index cacheSet;
+    Index cacheSet = addressToCacheSet(address);
+    int loc = findTagInSet(cacheSet, address);
 
-    cacheSet = addressToCacheSet(address);
-    m_replacementPolicy_ptr->
-        touch(cacheSet, findTagInSet(cacheSet, address),
-              g_eventQueue_ptr->getTime());
+    if(loc != -1)
+        m_replacementPolicy_ptr->
+             touch(cacheSet, loc, g_eventQueue_ptr->getTime());
 }
 
 void
index 1cd54d45c897b165441f94d7bf72078246d91b04..5f64a1ba45f92ccb1998b3c2467567b3577d5b15 100644 (file)
@@ -482,11 +482,9 @@ Sequencer::hitCallback(SequencerRequest* srequest,
 
     // Set this cache entry to the most recently used
     if (type == RubyRequestType_IFETCH) {
-        if (m_instCache_ptr->isTagPresent(request_line_address))
-            m_instCache_ptr->setMRU(request_line_address);
+        m_instCache_ptr->setMRU(request_line_address);
     } else {
-        if (m_dataCache_ptr->isTagPresent(request_line_address))
-            m_dataCache_ptr->setMRU(request_line_address);
+        m_dataCache_ptr->setMRU(request_line_address);
     }
 
     assert(g_eventQueue_ptr->getTime() >= issued_time);