summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mem/cache/cache.hh2
-rw-r--r--src/mem/coherent_xbar.hh2
-rw-r--r--src/sim/drain.cc11
-rw-r--r--src/sim/drain.hh4
4 files changed, 15 insertions, 4 deletions
diff --git a/src/mem/cache/cache.hh b/src/mem/cache/cache.hh
index 4f9142f7c..7f9130d62 100644
--- a/src/mem/cache/cache.hh
+++ b/src/mem/cache/cache.hh
@@ -52,6 +52,8 @@
#ifndef __MEM_CACHE_CACHE_HH__
#define __MEM_CACHE_CACHE_HH__
+#include <unordered_set>
+
#include "base/misc.hh" // fatal, panic, and warn
#include "enums/Clusivity.hh"
#include "mem/cache/base.hh"
diff --git a/src/mem/coherent_xbar.hh b/src/mem/coherent_xbar.hh
index 0f641664d..edfc47d4b 100644
--- a/src/mem/coherent_xbar.hh
+++ b/src/mem/coherent_xbar.hh
@@ -51,6 +51,8 @@
#ifndef __MEM_COHERENT_XBAR_HH__
#define __MEM_COHERENT_XBAR_HH__
+#include <unordered_set>
+
#include "mem/snoop_filter.hh"
#include "mem/xbar.hh"
#include "params/CoherentXBar.hh"
diff --git a/src/sim/drain.cc b/src/sim/drain.cc
index 085f781dc..bb8abd735 100644
--- a/src/sim/drain.cc
+++ b/src/sim/drain.cc
@@ -39,6 +39,8 @@
#include "sim/drain.hh"
+#include <algorithm>
+
#include "base/misc.hh"
#include "base/trace.hh"
#include "debug/Drain.hh"
@@ -126,6 +128,7 @@ DrainManager::preCheckpointRestore()
void
DrainManager::signalDrainDone()
{
+ assert(_count > 0);
if (--_count == 0) {
DPRINTF(Drain, "All %u objects drained..\n", drainableCount());
exitSimLoop("Finished drain", 0);
@@ -137,14 +140,18 @@ void
DrainManager::registerDrainable(Drainable *obj)
{
std::lock_guard<std::mutex> lock(globalLock);
- _allDrainable.insert(obj);
+ assert(std::find(_allDrainable.begin(), _allDrainable.end(), obj) ==
+ _allDrainable.end());
+ _allDrainable.push_back(obj);
}
void
DrainManager::unregisterDrainable(Drainable *obj)
{
std::lock_guard<std::mutex> lock(globalLock);
- _allDrainable.erase(obj);
+ auto o = std::find(_allDrainable.begin(), _allDrainable.end(), obj);
+ assert(o != _allDrainable.end());
+ _allDrainable.erase(o);
}
size_t
diff --git a/src/sim/drain.hh b/src/sim/drain.hh
index b3145e7ed..663946616 100644
--- a/src/sim/drain.hh
+++ b/src/sim/drain.hh
@@ -42,7 +42,7 @@
#include <atomic>
#include <mutex>
-#include <unordered_set>
+#include <vector>
class Drainable;
@@ -162,7 +162,7 @@ class DrainManager
mutable std::mutex globalLock;
/** Set of all drainable objects */
- std::unordered_set<Drainable *> _allDrainable;
+ std::vector<Drainable *> _allDrainable;
/**
* Number of objects still draining. This is flagged atomic since