fix the HACK when dealing with WhenTrigger data structure.
authorGengbin Zheng <gzheng@illinois.edu>
Mon, 24 Oct 2011 21:01:09 +0000 (16:01 -0500)
committerGengbin Zheng <gzheng@illinois.edu>
Mon, 24 Oct 2011 21:01:09 +0000 (16:01 -0500)
It is only work when "when" function is "void" type.

src/ck-core/sdag.h
src/xlat-i/sdag/CEntry.C
src/xlat-i/sdag/CSdagConstruct.C

index 8d2c912a4af3fbf41de154e47b9e9c42883f3eab..8b570e97e8590aca78968c1008c80f6d6f50f519 100644 (file)
@@ -62,7 +62,8 @@ class CWhenTrigger {
       // since CCounter is not pup'ed
       // don't expect Overlap works with load balancer 
       // as well as checkpointing
-      if (p.isUnpacking()) args[1]=0;            // HACK for load balancer
+      p(args, MAXARG);
+      //if (p.isUnpacking()) args[0]=0;            // HACK for load balancer
     }
 };
 
@@ -83,7 +84,7 @@ class TListCWhenTrigger
 
     void pup(PUP::er& p) {
       int nEntries=0;
-      int cur=0;
+      int cur=-1;
       if (!p.isUnpacking()) { 
         for (CWhenTrigger *tmp = first; tmp; tmp=tmp->next, nEntries++)
           if (current == tmp) cur = nEntries;
@@ -100,7 +101,8 @@ class TListCWhenTrigger
           }
           first = unpackArray[0];
           last = unpackArray[nEntries-1];
-          current = unpackArray[cur];
+          last->next = NULL;
+          current = cur==-1?NULL:unpackArray[cur];
           delete [] unpackArray;
         }
       }
index 50f54f9d9807f772dabb8e6ebfdd957a1bf1d19e..ed341303be0ab21dde0ec185e38defef778de6d3 100644 (file)
@@ -216,7 +216,8 @@ void CEntry::generateCode(XStr& op)
          iArgs++;
        }
        else if (sv->isVoid == 1) 
-           op <<"    CkFreeSysMsg((void  *)tr->args[" <<iArgs++ <<"]);\n";
+           // op <<"    CkFreeSysMsg((void  *)tr->args[" <<iArgs++ <<"]);\n";
+           op <<"    tr->args[" <<iArgs++ <<"] = 0;\n";
        else if ((sv->isMsg == 0) && (sv->isVoid == 0)) {
           if((i > 0) &&(lastWasVoid == 0)) 
             whenParams->append(", ");
@@ -296,7 +297,8 @@ void CEntry::generateCode(XStr& op)
            iArgs++;
          }
          else if (sv->isVoid == 1) 
-            op <<"    CkFreeSysMsg((void  *)tr->args[" <<iArgs++ <<"]);\n";
+            // op <<"    CkFreeSysMsg((void  *)tr->args[" <<iArgs++ <<"]);\n";
+            op <<"    tr->args[" <<iArgs++ <<"] = 0;\n";
          else if ((sv->isMsg == 0) && (sv->isVoid == 0)) {
             if((i > 0) && (lastWasVoid == 0))
               whenParams->append(", ");
index a5e4e3e0de21b2a8cecb6fcfe376fea887f0df0b..a55ed0a51762cb91d2b0743a11ddce9b06358188 100644 (file)
@@ -831,7 +831,8 @@ void SdagConstruct::generateWhen(XStr& op)
   int paramIndex =0;
   for(sv=stateVars->begin();!stateVars->end();sv=stateVars->next()) {
     if (sv->isVoid == 1) {
-       op <<"       tr->args[" <<iArgs++ <<"] = (size_t) CkAllocSysMsg();\n";
+       // op <<"       tr->args[" <<iArgs++ <<"] = (size_t) CkAllocSysMsg();\n";
+       op <<"       tr->args[" <<iArgs++ <<"] = (size_t)0xFF;\n";
     }
     else {
       if (sv->isMsg == 1) {