summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-06-10 23:17:07 -0700
committerNathan Binkert <nate@binkert.org>2010-06-10 23:17:07 -0700
commit3df84fd8a0ce3959c0deb4c206d910fc0d050f47 (patch)
treee9532570ee56986f92c40511f1fc83991d6691c9 /src/cpu
parent006818aeea6176c4500c5f7414e9f2a822c77062 (diff)
downloadgem5-3df84fd8a0ce3959c0deb4c206d910fc0d050f47.tar.xz
ruby: get rid of the Map class
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/rubytest/CheckTable.cc20
-rw-r--r--src/cpu/rubytest/CheckTable.hh6
2 files changed, 12 insertions, 14 deletions
diff --git a/src/cpu/rubytest/CheckTable.cc b/src/cpu/rubytest/CheckTable.cc
index 7588007c9..1c3444736 100644
--- a/src/cpu/rubytest/CheckTable.cc
+++ b/src/cpu/rubytest/CheckTable.cc
@@ -31,12 +31,10 @@
#include "cpu/rubytest/Check.hh"
#include "cpu/rubytest/CheckTable.hh"
#include "cpu/rubytest/CheckTable.hh"
-#include "mem/gems_common/Map.hh"
CheckTable::CheckTable(int _num_cpu_sequencers, RubyTester* _tester)
: m_num_cpu_sequencers(_num_cpu_sequencers), m_tester_ptr(_tester)
{
- m_lookup_map_ptr = new Map<Address, Check*>;
physical_address_t physical = 0;
Address address;
@@ -76,7 +74,6 @@ CheckTable::~CheckTable()
int size = m_check_vector.size();
for (int i = 0; i < size; i++)
delete m_check_vector[i];
- delete m_lookup_map_ptr;
}
void
@@ -89,7 +86,7 @@ CheckTable::addCheck(const Address& address)
}
for (int i = 0; i < CHECK_SIZE; i++) {
- if (m_lookup_map_ptr->exist(Address(address.getAddress()+i))) {
+ if (m_lookup_map.count(Address(address.getAddress()+i))) {
// A mapping for this byte already existed, discard the
// entire check
return;
@@ -100,7 +97,7 @@ CheckTable::addCheck(const Address& address)
m_num_cpu_sequencers, m_tester_ptr);
for (int i = 0; i < CHECK_SIZE; i++) {
// Insert it once per byte
- m_lookup_map_ptr->add(Address(address.getAddress() + i), check_ptr);
+ m_lookup_map[Address(address.getAddress() + i)] = check_ptr;
}
m_check_vector.push_back(check_ptr);
}
@@ -117,13 +114,14 @@ CheckTable::getCheck(const Address& address)
DEBUG_MSG(TESTER_COMP, MedPrio, "Looking for check by address");
DEBUG_EXPR(TESTER_COMP, MedPrio, address);
- if (m_lookup_map_ptr->exist(address)) {
- Check* check = m_lookup_map_ptr->lookup(address);
- assert(check != NULL);
- return check;
- } else {
+ m5::hash_map<Address, Check*>::iterator i = m_lookup_map.find(address);
+
+ if (i == m_lookup_map.end())
return NULL;
- }
+
+ Check* check = i->second;
+ assert(check != NULL);
+ return check;
}
void
diff --git a/src/cpu/rubytest/CheckTable.hh b/src/cpu/rubytest/CheckTable.hh
index 117fb1276..5a4ead337 100644
--- a/src/cpu/rubytest/CheckTable.hh
+++ b/src/cpu/rubytest/CheckTable.hh
@@ -33,12 +33,12 @@
#include <iostream>
#include <vector>
+#include "base/hashmap.hh"
+#include "mem/ruby/common/Address.hh"
#include "mem/ruby/common/Global.hh"
-class Address;
class Check;
class RubyTester;
-template <class KEY_TYPE, class VALUE_TYPE> class Map;
class CheckTable
{
@@ -64,7 +64,7 @@ class CheckTable
CheckTable& operator=(const CheckTable& obj);
std::vector<Check*> m_check_vector;
- Map<Address, Check*>* m_lookup_map_ptr;
+ m5::hash_map<Address, Check*> m_lookup_map;
int m_num_cpu_sequencers;
RubyTester* m_tester_ptr;