9 /* Queue message extraction calls: */
10 CqsEnumerateQueue((Queue)CpvAccess(CsdSchedQueue), &schedQueue);
11 FIFOQueue = CdsFifo_Enumerate((CdsFifo)CpvAccess(CmiLocalQueue));
12 DQueue = CdsFifo_Enumerate(CpvAccess(debugQueue));
15 /************ Charm++ Message PUP *****************/
18 0: pup each field separately, allows for debugging;
19 1: pup the message as a single array of bytes;
20 2: try to handle the cross platform compatibility where
21 Converse header sizes are different. Works same as 0,
22 but ignore the converse header. Cannot handle the case
23 in heterogeneous platforms where data type length is
26 void CkPupMessage(PUP::er &p,void **atMsg,int pack_mode) {
28 int size,prioBits,envSize;
30 /* pup this simple flag so that we can handle the NULL msg */
31 int isNull = (*atMsg == NULL); // be overwritten when unpacking
33 if (isNull) { *atMsg = NULL; return; }
35 envelope *env=UsrToEnv(*atMsg);
36 unsigned char wasPacked=0;
37 p.comment("Begin Charm++ Message {");
38 if (!p.isUnpacking()) {
39 wasPacked=env->isPacked();
40 if (0==wasPacked) //If it's not already packed...
41 CkPackMessage(&env); //Pack it
42 type=env->getMsgtype();
43 size=env->getTotalsize();
44 prioBits=env->getPriobits();
45 envSize=sizeof(envelope);
52 int userSize=size-envSize-sizeof(int)*CkPriobitsToInts(prioBits);
54 env=_allocEnv(type,userSize,prioBits);
56 /*Pup entire header and message as raw bytes.*/
59 else if (pack_mode == 2) {
60 /*Pup header in detail and message separately.*/
61 /* note that it can be that sizeof(envelope) != envSize */
63 p((char*)env+sizeof(envelope),size-envSize);
66 { /*Pup each field separately, which allows debugging*/
67 p.comment("Message Envelope:");
69 p.comment("Message User Data:");
70 #if 0 /* Messages *should* be packed according to entry point: */
71 int ep=env->getEpIdx();
72 if (ep>0 && ep<_numEntries)
73 _entryTable[ep]->pupFn(p,*atMsg);
76 ((CkMessage *)*atMsg)->pup(p);
77 p.comment("} End Charm++ Message");
79 if (0==wasPacked) //Restore the packed-ness to previous state-- unpacked
80 CkUnpackMessage(&env);
84 void envelope::pup(PUP::er &p) {
85 //message type, totalsize, and priobits are already pup'd (above)
87 if (!p.isUnpacking()) convHeaderSize = CmiReservedHeaderSize;
89 //puping converse hdr hopefully not go beyond boundry
90 p((char *)core,convHeaderSize);
92 //p((char *)&attribs,sizeof(attribs));
96 if (!p.isUnpacking()) d = attribs.queueing;
97 //cppcheck-suppress uninitvar
99 if (p.isUnpacking()) attribs.queueing = d;
100 if (!p.isUnpacking()) d = attribs.isPacked;
102 if (p.isUnpacking()) attribs.isPacked = d;
103 if (!p.isUnpacking()) d = attribs.isUsed;
105 if (p.isUnpacking()) attribs.isUsed = d;
108 #if CMK_REPLAYSYSTEM || CMK_TRACE_ENABLED
111 p((char*)getPrioPtr(),getPrioBytes());
112 switch(getMsgtype()) {
113 case NewChareMsg: case NewVChareMsg:
114 case ForChareMsg: case ForVidMsg: case FillVidMsg:
115 p((char *)&(type.chare.ptr),sizeof(void *));
116 p(type.chare.forAnyPe);
118 case NodeBocInitMsg: case BocInitMsg: case ForNodeBocMsg: case ForBocMsg:
120 p|type.group.rednMgr;
123 p|type.group.arrayEp;
125 case ArrayEltInitMsg: case ForArrayEltMsg:
128 p(type.array.hopCount);
129 p(type.array.ifNotThere);
132 p(type.roData.count);
137 default: /*No type-dependent fields to pack*/
142 void CkMessage::pup(PUP::er &p) {
143 //Default message pup: just copy user portion as bytes
144 envelope *env=UsrToEnv((void *)this);
145 int userSize=env->getTotalsize()-sizeof(envelope)-env->getPrioBytes();
146 p((char *)this,userSize);