From: Curtis Dunham Date: Thu, 26 Mar 2015 15:16:44 +0000 (-0400) Subject: sim: Update limit_event reuse to final version X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a1164154ded6c1fa3c6a94f38abfcf96aefc20aa;p=gem5.git sim: Update limit_event reuse to final version Matching final version on reviewboard. --- diff --git a/src/sim/sim_events.hh b/src/sim/sim_events.hh index 4d001f8f0..5be2609fd 100644 --- a/src/sim/sim_events.hh +++ b/src/sim/sim_events.hh @@ -71,11 +71,6 @@ class GlobalSimLoopExitEvent : public GlobalEvent void process(); // process event virtual const char *description() const; - - virtual ~GlobalSimLoopExitEvent() { - // simulate()'s singleton GlobalSimLoopExitEvent is always scheduled - deschedule(); - } }; class LocalSimLoopExitEvent : public Event diff --git a/src/sim/simulate.cc b/src/sim/simulate.cc index 14dd00fc1..e0b80bbe8 100644 --- a/src/sim/simulate.cc +++ b/src/sim/simulate.cc @@ -71,13 +71,7 @@ thread_loop(EventQueue *queue) } } -GlobalEvent* -getLimitEvent(void) { - static GlobalSimLoopExitEvent - simulate_limit_event(mainEventQueue[0]->getCurTick(), - "simulate() limit reached", 0); - return &simulate_limit_event; -} +GlobalSimLoopExitEvent *simulate_limit_event = nullptr; /** Simulate for num_cycles additional cycles. If num_cycles is -1 * (the default), do not limit simulation; some other event must @@ -104,6 +98,9 @@ simulate(Tick num_cycles) } threads_initialized = true; + simulate_limit_event = + new GlobalSimLoopExitEvent(mainEventQueue[0]->getCurTick(), + "simulate() limit reached", 0); } inform("Entering event queue @ %d. Starting simulation...\n", curTick()); @@ -113,7 +110,7 @@ simulate(Tick num_cycles) else // counter would roll over or be set to MaxTick anyhow num_cycles = MaxTick; - getLimitEvent()->reschedule(num_cycles); + simulate_limit_event->reschedule(num_cycles); GlobalSyncEvent *quantum_event = NULL; if (numMainEventQueues > 1) { diff --git a/src/sim/simulate.hh b/src/sim/simulate.hh index 18be7ea82..85d58e119 100644 --- a/src/sim/simulate.hh +++ b/src/sim/simulate.hh @@ -33,4 +33,4 @@ #include "sim/sim_events.hh" GlobalSimLoopExitEvent *simulate(Tick num_cycles = MaxTick); -GlobalEvent* getLimitEvent(); +extern GlobalSimLoopExitEvent *simulate_limit_event;