template <class Impl>
DefaultCommit<Impl>::TrapEvent::TrapEvent(DefaultCommit<Impl> *_commit,
ThreadID _tid)
- : Event(CPU_Tick_Pri), commit(_commit), tid(_tid)
+ : Event(CPU_Tick_Pri, AutoDelete), commit(_commit), tid(_tid)
{
- this->setFlags(AutoDelete);
}
template <class Impl>
template <class Impl>
InstructionQueue<Impl>::FUCompletion::FUCompletion(DynInstPtr &_inst,
int fu_idx, InstructionQueue<Impl> *iq_ptr)
- : Event(Stat_Event_Pri), inst(_inst), fuIdx(fu_idx), iqPtr(iq_ptr),
- freeFU(false)
+ : Event(Stat_Event_Pri, AutoDelete),
+ inst(_inst), fuIdx(fu_idx), iqPtr(iq_ptr), freeFU(false)
{
- this->setFlags(Event::AutoDelete);
}
template <class Impl>
template<class Impl>
LSQUnit<Impl>::WritebackEvent::WritebackEvent(DynInstPtr &_inst, PacketPtr _pkt,
LSQUnit *lsq_ptr)
- : inst(_inst), pkt(_pkt), lsqPtr(lsq_ptr)
+ : Event(Default_Pri, AutoDelete),
+ inst(_inst), pkt(_pkt), lsqPtr(lsq_ptr)
{
- this->setFlags(Event::AutoDelete);
}
template<class Impl>
}
LinkDelayEvent::LinkDelayEvent()
- : link(NULL)
+ : Event(Default_Pri, AutoSerialize | AutoDelete), link(NULL)
{
- setFlags(AutoSerialize);
- setFlags(AutoDelete);
}
LinkDelayEvent::LinkDelayEvent(EtherLink::Link *l, EthPacketPtr p)
- : link(l), packet(p)
+ : Event(Default_Pri, AutoSerialize | AutoDelete), link(l), packet(p)
{
- setFlags(AutoSerialize);
- setFlags(AutoDelete);
}
void
{
public:
RubyEventQueueNode(Consumer* _consumer, RubyEventQueue* _eventq)
- : m_consumer_ptr(_consumer), m_eventq_ptr(_eventq)
+ : Event(Default_Pri, AutoDelete),
+ m_consumer_ptr(_consumer), m_eventq_ptr(_eventq)
{
- setFlags(AutoDelete);
}
void print(std::ostream& out) const;
// constructor: schedule at specified time
//
DebugBreakEvent::DebugBreakEvent()
- : Event(Debug_Break_Pri)
+ : Event(Debug_Break_Pri, AutoDelete)
{
- setFlags(AutoDelete);
}
//
return flags & PublicRead;
}
- Flags
- getFlags(Flags _flags) const
+ bool
+ isFlagSet(Flags _flags) const
{
assert(_flags.noneSet(~PublicRead));
return flags.isSet(_flags);
}
- Flags
- allFlags(Flags _flags) const
- {
- assert(_flags.noneSet(~PublicRead));
- return flags.allSet(_flags);
- }
-
/// Accessor for flags.
void
setFlags(Flags _flags)
* Event constructor
* @param queue that the event gets scheduled on
*/
- Event(Priority p = Default_Pri)
- : nextBin(NULL), nextInBin(NULL), _priority(p), flags(Initialized)
+ Event(Priority p = Default_Pri, Flags f = 0)
+ : nextBin(NULL), nextInBin(NULL), _priority(p),
+ flags(Initialized | f)
{
+ assert(f.noneSet(~PublicWrite));
#ifndef NDEBUG
instance = ++instanceCounter;
queue = NULL;
}
}
- // default: process all events up to 'now' (curTick())
- void serviceEvents() { serviceEvents(curTick()); }
-
// return true if no events are queued
bool empty() const { return head == NULL; }
void dump() const;
- Tick nextEventTime() { return empty() ? curTick() : head->when(); }
-
bool debugVerify() const;
#ifndef SWIG
public:
DelayEvent(T *o)
- : object(o)
- { this->setFlags(AutoDelete); }
+ : Event(Default_Pri, AutoDelete), object(o)
+ { }
void process() { (object->*F)(); }
const char *description() const { return "delay"; }
};
using namespace std;
SimLoopExitEvent::SimLoopExitEvent(const std::string &_cause, int c, Tick r)
- : Event(Sim_Exit_Pri), cause(_cause), code(c), repeat(r)
+ : Event(Sim_Exit_Pri, IsExitEvent), cause(_cause), code(c), repeat(r)
{
- setFlags(IsExitEvent);
}
// if this got scheduled on a different queue (e.g. the committed
// instruction queue) then make a corresponding event on the main
// queue.
- if (!getFlags(IsMainQueue)) {
+ if (!isFlagSet(IsMainQueue)) {
exitSimLoop(cause, code);
delete this;
}
// but if you are doing this on intervals, don't forget to make another
if (repeat) {
- assert(getFlags(IsMainQueue));
+ assert(isFlagSet(IsMainQueue));
mainEventQueue.schedule(this, curTick() + repeat);
}
}
public:
StatEvent(bool _dump, bool _reset, Tick _repeat)
- : Event(Stat_Event_Pri), dump(_dump), reset(_reset), repeat(_repeat)
+ : Event(Stat_Event_Pri, AutoDelete),
+ dump(_dump), reset(_reset), repeat(_repeat)
{
- setFlags(AutoDelete);
}
virtual void