ruby: get rid of the Map class
[gem5.git] / src / mem / ruby / system / PerfectCacheMemory.hh
index f1fb8b2e96569da6122e8cfff96a4ec0fddcf46a..823dd7071c34068c2ace2f9e18050eb784b0833d 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef __MEM_RUBY_SYSTEM_PERFECTCACHEMEMORY_HH__
 #define __MEM_RUBY_SYSTEM_PERFECTCACHEMEMORY_HH__
 
-#include "mem/gems_common/Map.hh"
+#include "base/hashmap.hh"
 #include "mem/protocol/AccessPermission.hh"
 #include "mem/ruby/common/Address.hh"
 #include "mem/ruby/common/Global.hh"
@@ -43,8 +43,8 @@ struct PerfectCacheLineState
 };
 
 template<class ENTRY>
-inline ostream&
-operator<<(ostream& out, const PerfectCacheLineState<ENTRY>& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const PerfectCacheLineState<ENTRY>& obj)
 {
     return out;
 }
@@ -55,7 +55,7 @@ class PerfectCacheMemory
   public:
     PerfectCacheMemory();
 
-    static void printConfig(ostream& out);
+    static void printConfig(std::ostream& out);
 
     // perform a cache access and see if we hit or not.  Return true
     // on a hit.
@@ -86,7 +86,7 @@ class PerfectCacheMemory
     void changePermission(const Address& address, AccessPermission new_perm);
 
     // Print cache contents
-    void print(ostream& out) const;
+    void print(std::ostream& out) const;
 
   private:
     // Private copy constructor and assignment operator
@@ -94,15 +94,15 @@ class PerfectCacheMemory
     PerfectCacheMemory& operator=(const PerfectCacheMemory& obj);
 
     // Data Members (m_prefix)
-    Map<Address, PerfectCacheLineState<ENTRY> > m_map;
+    m5::hash_map<Address, PerfectCacheLineState<ENTRY> > m_map;
 };
 
 template<class ENTRY>
-inline ostream&
-operator<<(ostream& out, const PerfectCacheMemory<ENTRY>& obj)
+inline std::ostream&
+operator<<(std::ostream& out, const PerfectCacheMemory<ENTRY>& obj)
 {
     obj.print(out);
-    out << flush;
+    out << std::flush;
     return out;
 }
 
@@ -114,7 +114,7 @@ PerfectCacheMemory<ENTRY>::PerfectCacheMemory()
 
 template<class ENTRY>
 inline void
-PerfectCacheMemory<ENTRY>::printConfig(ostream& out)
+PerfectCacheMemory<ENTRY>::printConfig(std::ostream& out)
 {
 }
 
@@ -131,7 +131,7 @@ template<class ENTRY>
 inline bool
 PerfectCacheMemory<ENTRY>::isTagPresent(const Address& address) const
 {
-    return m_map.exist(line_address(address));
+    return m_map.count(line_address(address)) > 0;
 }
 
 template<class ENTRY>
@@ -150,7 +150,7 @@ PerfectCacheMemory<ENTRY>::allocate(const Address& address)
     PerfectCacheLineState<ENTRY> line_state;
     line_state.m_permission = AccessPermission_Busy;
     line_state.m_entry = ENTRY();
-    m_map.add(line_address(address), line_state);
+    m_map[line_address(address)] = line_state;
 }
 
 // deallocate entry
@@ -174,7 +174,7 @@ template<class ENTRY>
 inline ENTRY&
 PerfectCacheMemory<ENTRY>::lookup(const Address& address)
 {
-    return m_map.lookup(line_address(address)).m_entry;
+    return m_map[line_address(address)].m_entry;
 }
 
 // looks an address up in the cache
@@ -182,14 +182,14 @@ template<class ENTRY>
 inline const ENTRY&
 PerfectCacheMemory<ENTRY>::lookup(const Address& address) const
 {
-    return m_map.lookup(line_address(address)).m_entry;
+    return m_map[line_address(address)].m_entry;
 }
 
 template<class ENTRY>
 inline AccessPermission
 PerfectCacheMemory<ENTRY>::getPermission(const Address& address) const
 {
-    return m_map.lookup(line_address(address)).m_permission;
+    return m_map[line_address(address)].m_permission;
 }
 
 template<class ENTRY>
@@ -199,14 +199,14 @@ PerfectCacheMemory<ENTRY>::changePermission(const Address& address,
 {
     Address line_address = address;
     line_address.makeLineAddress();
-    PerfectCacheLineState<ENTRY>& line_state = m_map.lookup(line_address);
+    PerfectCacheLineState<ENTRY>& line_state = m_map[line_address];
     AccessPermission old_perm = line_state.m_permission;
     line_state.m_permission = new_perm;
 }
 
 template<class ENTRY>
 inline void
-PerfectCacheMemory<ENTRY>::print(ostream& out) const
+PerfectCacheMemory<ENTRY>::print(std::ostream& out) const
 {
 }