8 #include "event.decl.h" 42 virtual void pup(PUP::er& p) {
113 memset(
this, 0,
sizeof(
tw_bf));
118 void pup_causality(PUP::er& p,
Event* e);
150 unsigned pending_count;
151 unsigned processed_count;
153 unsigned* pending_indices;
154 unsigned* processed_indices;
161 event_id = dest_lp = src_lp = 0;
169 next = prev = caused_by_me = cause_next = cancel_next = NULL;
171 type_id = type_size = index = 0;
173 pending_count = processed_count = sent_count = 0;
174 pending_indices = processed_indices = NULL;
176 void pup(PUP::er& p) {
182 if (p.isUnpacking()) {
191 if (p.isUnpacking()) {
196 pup_causality(p,
this);
203 CkAbort(
"Bad event state during pupping\n");
210 event_id = msg->event_id;
211 src_lp = msg->src_lp;
212 dest_lp = msg->dest_lp;
214 type_size = msg->type_size;
221 template<
typename DataType>
223 return reinterpret_cast<DataType*
>(msg->
data);
229 bool operator()(
const Event* e1,
const Event* e2);
234 bool operator()(
const Event* e1,
const Event* e2);
239 static inline void link_causality(
Event* nev,
Event* cev) {
240 nev->cause_next = cev->caused_by_me;
241 cev->caused_by_me = nev;
253 void tw_event_free(
Event* e,
bool commit);
254 void tw_event_rollback(
Event* event);
258 void charm_event_cancel(
Event* e);
259 void charm_anti_send(
unsigned,
Event* e);
262 template <
typename MsgType>
263 uint32_t get_msg_id() {
268 template <
typename MsgType>
269 void register_msg_type() {
270 get_msg_id<MsgType>();
273 template <
typename LPType>
276 virtual void forward(LPType* lp,
Event* e) = 0;
277 virtual void reverse(LPType* lp,
Event* e) = 0;
278 virtual void commit(LPType* lp,
Event* e) = 0;
281 template <
typename LPType,
typename MsgType>
284 void forward(LPType* lp,
Event* e) {
285 lp->forward(e->
get_data<MsgType>(), &e->cv);
287 void reverse(LPType* lp,
Event* e) {
288 lp->reverse(e->
get_data<MsgType>(), &e->cv);
290 void commit(LPType* lp,
Event* e) {
291 lp->commit(e->
get_data<MsgType>(), &e->cv);
303 template <
typename MsgType,
typename... Args>
306 msg->
type_id = get_msg_id<MsgType>();
307 msg->type_size =
sizeof(MsgType);
308 new (msg->
data) MsgType(std::forward<Args>(args)...);
unsigned char owner
Which queue I am in; see tw_event_owner.
Definition: event.h:64
char * data
Points to memory for user event data.
Definition: event.h:40
unsigned char cancel_q
Actively on a dest_lp->pe's cancel_q.
Definition: event.h:65
Event * event_alloc(RemoteEvent *event, uint64_t dest_gid, Time offset, LPBase *sender)
Send a previously allocated event.
Definition: event.C:47
Declarations for global variables and associated functions.
Event sent to someone else.
Definition: event.h:60
DataType * get_data() const
Public accessor for the event payload, cast as the specified type.
Definition: event.h:222
void tw_event_send(Event *event)
Sends an event to its destination LP.
Definition: event.C:95
Event in unknown location.
Definition: event.h:57
In the chare's rollback queue.
Definition: event.h:59
tw_bf
Definition: event.h:78
tw_event_owner
Definition: event.h:56
Event * tw_event_new(uint64_t dest_gid, Time offset, LPBase *sender, Args &&... args)
Creates an Event with the appropriate payload type for the desired destination and offset in virtual ...
Definition: event.h:304
unsigned char avl_tree
Indicates that the event is in the AVL tree.
Definition: event.h:67
uint8_t type_id
Used for double-dispatch of event data.
Definition: event.h:38
uint32_t g_num_msg_types
number of message types
Definition: globals.C:25
Declares most types used within the simulator and by models.
unsigned char remote
Indicates union addr is in 'remote' storage.
Definition: event.h:66
Non-templated base class for LP, so that the simulator can deal with a single LP base type...
Definition: lp.h:265
In the chare's pending queue.
Definition: event.h:58