summaryrefslogtreecommitdiff
path: root/src/cpu/o3/ras.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu/o3/ras.cc')
-rw-r--r--src/cpu/o3/ras.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/cpu/o3/ras.cc b/src/cpu/o3/ras.cc
index 0a7d6ca63..0b3ea4918 100644
--- a/src/cpu/o3/ras.cc
+++ b/src/cpu/o3/ras.cc
@@ -28,12 +28,24 @@
#include "cpu/o3/ras.hh"
-ReturnAddrStack::ReturnAddrStack(unsigned _numEntries)
- : numEntries(_numEntries), usedEntries(0),
- tos(0)
+void
+ReturnAddrStack::init(unsigned _numEntries)
{
- addrStack = new Addr[numEntries];
+ numEntries = _numEntries;
+ usedEntries = 0;
+ tos = 0;
+
+ addrStack.resize(numEntries);
+
+ for (int i = 0; i < numEntries; ++i)
+ addrStack[i] = 0;
+}
+void
+ReturnAddrStack::reset()
+{
+ usedEntries = 0;
+ tos = 0;
for (int i = 0; i < numEntries; ++i)
addrStack[i] = 0;
}
@@ -53,9 +65,6 @@ ReturnAddrStack::push(const Addr &return_addr)
void
ReturnAddrStack::pop()
{
- // Not sure it's possible to really track usedEntries properly.
-// assert(usedEntries > 0);
-
if (usedEntries > 0) {
--usedEntries;
}