eventq: convert all usage of events to use the new API.
For now, there is still a single global event queue, but this is necessary for making the steps towards a parallelized m5.
This commit is contained in:
@@ -43,7 +43,7 @@ using namespace std;
|
||||
using namespace TheISA;
|
||||
|
||||
AtomicSimpleCPU::TickEvent::TickEvent(AtomicSimpleCPU *c)
|
||||
: Event(&mainEventQueue, CPU_Tick_Pri), cpu(c)
|
||||
: Event(CPU_Tick_Pri), cpu(c)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -201,9 +201,8 @@ AtomicSimpleCPU::resume()
|
||||
|
||||
changeState(SimObject::Running);
|
||||
if (thread->status() == ThreadContext::Active) {
|
||||
if (!tickEvent.scheduled()) {
|
||||
tickEvent.schedule(nextCycle());
|
||||
}
|
||||
if (!tickEvent.scheduled())
|
||||
schedule(tickEvent, nextCycle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +229,7 @@ AtomicSimpleCPU::takeOverFrom(BaseCPU *oldCPU)
|
||||
ThreadContext *tc = threadContexts[i];
|
||||
if (tc->status() == ThreadContext::Active && _status != Running) {
|
||||
_status = Running;
|
||||
tickEvent.schedule(nextCycle());
|
||||
schedule(tickEvent, nextCycle());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -260,7 +259,7 @@ AtomicSimpleCPU::activateContext(int thread_num, int delay)
|
||||
numCycles += tickToCycles(thread->lastActivate - thread->lastSuspend);
|
||||
|
||||
//Make sure ticks are still on multiples of cycles
|
||||
tickEvent.schedule(nextCycle(curTick + ticks(delay)));
|
||||
schedule(tickEvent, nextCycle(curTick + ticks(delay)));
|
||||
_status = Running;
|
||||
}
|
||||
|
||||
@@ -278,7 +277,7 @@ AtomicSimpleCPU::suspendContext(int thread_num)
|
||||
// tick event may not be scheduled if this gets called from inside
|
||||
// an instruction's execution, e.g. "quiesce"
|
||||
if (tickEvent.scheduled())
|
||||
tickEvent.deschedule();
|
||||
deschedule(tickEvent);
|
||||
|
||||
notIdleFraction--;
|
||||
_status = Idle;
|
||||
@@ -794,7 +793,7 @@ AtomicSimpleCPU::tick()
|
||||
latency = ticks(1);
|
||||
|
||||
if (_status != Idle)
|
||||
tickEvent.schedule(curTick + latency);
|
||||
schedule(tickEvent, curTick + latency);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ void
|
||||
TimingSimpleCPU::CpuPort::TickEvent::schedule(PacketPtr _pkt, Tick t)
|
||||
{
|
||||
pkt = _pkt;
|
||||
Event::schedule(t);
|
||||
cpu->schedule(this, t);
|
||||
}
|
||||
|
||||
TimingSimpleCPU::TimingSimpleCPU(TimingSimpleCPUParams *p)
|
||||
@@ -165,7 +165,7 @@ TimingSimpleCPU::resume()
|
||||
// Delete the old event if it existed.
|
||||
if (fetchEvent) {
|
||||
if (fetchEvent->scheduled())
|
||||
fetchEvent->deschedule();
|
||||
deschedule(fetchEvent);
|
||||
|
||||
delete fetchEvent;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ TimingSimpleCPU::switchOut()
|
||||
// If we've been scheduled to resume but are then told to switch out,
|
||||
// we'll need to cancel it.
|
||||
if (fetchEvent && fetchEvent->scheduled())
|
||||
fetchEvent->deschedule();
|
||||
deschedule(fetchEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +228,8 @@ TimingSimpleCPU::activateContext(int thread_num, int delay)
|
||||
_status = Running;
|
||||
|
||||
// kick things off by initiating the fetch of the next instruction
|
||||
fetchEvent = new FetchEvent(this, nextCycle(curTick + ticks(delay)));
|
||||
fetchEvent = new FetchEvent(this);
|
||||
schedule(fetchEvent, nextCycle(curTick + ticks(delay)));
|
||||
}
|
||||
|
||||
|
||||
@@ -819,10 +820,11 @@ TimingSimpleCPU::DcachePort::recvRetry()
|
||||
}
|
||||
}
|
||||
|
||||
TimingSimpleCPU::IprEvent::IprEvent(Packet *_pkt, TimingSimpleCPU *_cpu, Tick t)
|
||||
: Event(&mainEventQueue), pkt(_pkt), cpu(_cpu)
|
||||
TimingSimpleCPU::IprEvent::IprEvent(Packet *_pkt, TimingSimpleCPU *_cpu,
|
||||
Tick t)
|
||||
: pkt(_pkt), cpu(_cpu)
|
||||
{
|
||||
schedule(t);
|
||||
cpu->schedule(this, t);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -80,8 +80,7 @@ class TimingSimpleCPU : public BaseSimpleCPU
|
||||
PacketPtr pkt;
|
||||
TimingSimpleCPU *cpu;
|
||||
|
||||
TickEvent(TimingSimpleCPU *_cpu)
|
||||
:Event(&mainEventQueue), cpu(_cpu) {}
|
||||
TickEvent(TimingSimpleCPU *_cpu) : cpu(_cpu) {}
|
||||
const char *description() const { return "Timing CPU tick"; }
|
||||
void schedule(PacketPtr _pkt, Tick t);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user