summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2003-10-13 22:19:43 -0400
committerNathan Binkert <binkertn@umich.edu>2003-10-13 22:19:43 -0400
commit481aaf03cf933c13c3d9bf294629c6740726025e (patch)
tree22c6af4e2376cbd955e68a16387a2692385b03fb
parentf94ff9ace556d9aa1ac9d00b8b1dbc73e161d213 (diff)
downloadgem5-481aaf03cf933c13c3d9bf294629c6740726025e.tar.xz
Small optimization
cpu/pc_event.cc: cpu/pc_event.hh: Do a quick check to see if there is anything to service before the function is called --HG-- extra : convert_revision : 16e9b6284ece8b7a53ccf0ca200fab9ba780c50c
-rw-r--r--cpu/pc_event.cc2
-rw-r--r--cpu/pc_event.hh10
2 files changed, 10 insertions, 2 deletions
diff --git a/cpu/pc_event.cc b/cpu/pc_event.cc
index 7b72f5c08..8c584a492 100644
--- a/cpu/pc_event.cc
+++ b/cpu/pc_event.cc
@@ -84,7 +84,7 @@ PCEventQueue::schedule(PCEvent *event)
}
bool
-PCEventQueue::service(ExecContext *xc)
+PCEventQueue::doService(ExecContext *xc)
{
Addr pc = xc->regs.pc;
int serviced = 0;
diff --git a/cpu/pc_event.hh b/cpu/pc_event.hh
index 08c6fa59a..d452bc030 100644
--- a/cpu/pc_event.hh
+++ b/cpu/pc_event.hh
@@ -98,13 +98,21 @@ class PCEventQueue
protected:
map_t pc_map;
+ bool doService(ExecContext *xc);
+
public:
PCEventQueue();
~PCEventQueue();
bool remove(PCEvent *event);
bool schedule(PCEvent *event);
- bool service(ExecContext *xc);
+ bool service(ExecContext *xc)
+ {
+ if (pc_map.empty())
+ return false;
+
+ return doService(xc);
+ }
range_t equal_range(Addr pc);
range_t equal_range(PCEvent *event) { return equal_range(event->pc()); }