summaryrefslogtreecommitdiff
path: root/src/cpu/pred/tournament.cc
diff options
context:
space:
mode:
authorMitch Hayenga <mitch.hayenga@arm.com>2014-09-03 07:42:36 -0400
committerMitch Hayenga <mitch.hayenga@arm.com>2014-09-03 07:42:36 -0400
commitdaedc5a49127eb91036291af1619bbc98016aff0 (patch)
tree6bf2ac8d871cd9b4c49c3aa0dc48096f76dfe427 /src/cpu/pred/tournament.cc
parentecd53009712da59a98ad3c13ed20aaa8e8cd7e29 (diff)
downloadgem5-daedc5a49127eb91036291af1619bbc98016aff0.tar.xz
cpu: Fix incorrect speculative branch predictor behavior
When a branch mispredicted gem5 would squash all history after and including the mispredicted branch. However, the mispredicted branch is still speculative and its history is required to rollback state if another, older, branch mispredicts. This leads to things like RAS corruption.
Diffstat (limited to 'src/cpu/pred/tournament.cc')
-rw-r--r--src/cpu/pred/tournament.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/cpu/pred/tournament.cc b/src/cpu/pred/tournament.cc
index e471d08f5..c6514b6ad 100644
--- a/src/cpu/pred/tournament.cc
+++ b/src/cpu/pred/tournament.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011 ARM Limited
+ * Copyright (c) 2011, 2014 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
@@ -346,10 +346,10 @@ TournamentBP::update(Addr branch_addr, bool taken, void *bp_history,
}
}
+ } else {
+ // We're done with this history, now delete it.
+ delete history;
}
- // We're done with this history, now delete it.
- delete history;
-
}
assert(local_history_idx < localHistoryTableSize);
@@ -358,6 +358,13 @@ TournamentBP::update(Addr branch_addr, bool taken, void *bp_history,
}
void
+TournamentBP::retireSquashed(void *bp_history)
+{
+ BPHistory *history = static_cast<BPHistory *>(bp_history);
+ delete history;
+}
+
+void
TournamentBP::squash(void *bp_history)
{
BPHistory *history = static_cast<BPHistory *>(bp_history);