2 #include "xi-Parameter.h"
8 /******************* C/C++ Parameter Marshalling ******************
9 For entry methods like:
10 entry void foo(int nx,double xarr[nx],complex<float> yarr[ny],long ny);
12 We generate code on the call-side (in the proxy entry method) to
13 create a message and copy the user's parameters into it. Scalar
14 fields are PUP'd, arrays are just memcpy'd.
16 The message looks like this:
18 messagestart>--------- PUP'd data ----------------
20 | PUP'd offset-to-xarr (from array start, int byte count)
21 | PUP'd length-of-xarr (in elements)
22 | PUP'd offset-to-yarr
23 | PUP'd length-of-yarr (in elements)
25 +-------------------------------------------
26 | alignment gap (to multiple of 16 bytes)
27 arraystart>------- xarr data ----------
32 +------------------------------
33 | alignment gap (for yarr-elements)
34 +--------- yarr data ----------
39 +------------------------------
41 On the recieve side, all the scalar fields are PUP'd to fresh
42 stack copies, and the arrays are passed to the user as pointers
43 into the message data-- so there's no copy on the receive side.
45 The message is freed after the user entry returns.
47 Parameter::Parameter(int Nline, Type* Ntype, const char* Nname, const char* NarrLen,
62 if (name == NULL && !isVoid()) { /*Fabricate a unique name for this marshalled param.*/
63 static int unnamedCount = 0;
65 sprintf((char*)name, "impl_noname_%x", unnamedCount++);
68 declaredReference = false;
69 if ((arrLen == NULL) && (val == NULL)) { /* Consider passing type by reference: */
70 if (type->isNamed()) { /* Some user-defined type: pass by reference */
73 if (type->isReference()) {
75 declaredReference = true;
76 /* Clip off the ampersand--we'll add
77 it back ourselves in Parameter::print. */
80 if (type->isConst()) {
87 ParamList::ParamList(ParamList* pl)
88 : manyPointers(false), param(pl->param), next(pl->next) {}
90 int ParamList::print(XStr& str, int withDefaultValues, int useConst, int fwdNum) {
91 fwdNum = param->print(str, withDefaultValues, useConst, fwdNum);
94 fwdNum = next->print(str, withDefaultValues, useConst, fwdNum);
99 void ParamList::printTypes(XStr& str, int withDefaultValues, int useConst) {
101 param->getType()->print(typeStr);
105 next->printTypes(str, withDefaultValues, useConst);
109 int Parameter::print(XStr& str, int withDefaultValues, int useConst, int fwdNum) {
111 str << "CkRdmaWrapper rdmawrapper_" << name;
112 } else if (arrLen != NULL) { // Passing arrays by const pointer-reference
113 if (useConst) str << "const ";
115 if (name != NULL) str << name;
118 str << type << " *" << name;
119 } else if (byReference) { // Pass named types by const C++ reference
121 str << "Fwd" << fwdNum++ << " &&";
123 if (useConst || byConst) str << "const ";
126 if (name != NULL) str << name;
127 } else { // Pass everything else by value
128 // @TODO uncommenting this requires that PUP work on const types
129 // if (byConst) str << "const ";
130 //"void" shouldn't be typed in the param list
131 // to have CkEntryOptions as the last argument
132 if (!type->isVoid()) str << type;
133 if (name != NULL) str << " " << name;
134 if (withDefaultValues && val != NULL) {
143 void ParamList::printAddress(XStr& str) {
144 param->printAddress(str);
147 next->printAddress(str);
151 void Parameter::printAddress(XStr& str) {
154 if (name != NULL) str << " " << name;
157 void ParamList::printValue(XStr& str) {
158 param->printValue(str);
161 next->printValue(str);
165 void Parameter::printValue(XStr& str) {
166 if (arrLen == NULL) str << "*";
167 if (name != NULL) str << name;
170 int ParamList::orEach(pred_t f) {
171 ParamList* cur = this;
174 ret |= ((cur->param)->*f)();
175 } while (NULL != (cur = cur->next));
179 void ParamList::callEach(fn_t f, XStr& str) {
180 ParamList* cur = this;
182 ((cur->param)->*f)(str);
183 } while (NULL != (cur = cur->next));
186 void ParamList::callEach(rdmafn_t f, XStr& str, bool isArray) {
187 ParamList* cur = this;
189 ((cur->param)->*f)(str, isArray);
190 } while (NULL != (cur = cur->next));
193 int ParamList::hasConditional() { return orEach(&Parameter::isConditional); }
195 /** marshalling: pack fields into flat byte buffer **/
196 void ParamList::marshall(XStr& str, XStr& entry) {
198 str << " void *impl_msg = CkAllocSysMsg(impl_e_opts);\n";
199 else if (isMarshalled()) {
200 str << " //Marshall: ";
203 // First pass: find sizes
204 str << " int impl_off=0;\n";
205 int hasArrays = orEach(&Parameter::isArray);
207 str << " int impl_arrstart=0;\n";
208 callEach(&Parameter::marshallRegArraySizes, str);
210 bool hasrdma = hasRdma();
212 str << "#if CMK_ONESIDED_IMPL\n";
213 str << " int impl_num_rdma_fields = 0; \n";
214 callEach(&Parameter::marshallRdmaParameters, str, true);
216 if (!hasArrays) str << " int impl_arrstart=0;\n";
217 callEach(&Parameter::marshallRdmaParameters, str, false);
220 str << " { //Find the size of the PUP'd data\n";
221 str << " PUP::sizer implP;\n";
222 callEach(&Parameter::pup, str);
224 str << "#if CMK_ONESIDED_IMPL\n";
225 str << " implP|impl_num_rdma_fields;\n";
226 // All rdma parameters have to be pupped at the start
227 callEach(&Parameter::pupRdma, str, true);
229 callEach(&Parameter::pupRdma, str, false);
231 str << " impl_arrstart=CK_ALIGN(implP.size(),16);\n";
232 str << " impl_off+=impl_arrstart;\n";
236 if (hasArrays) { /*round up pup'd data length--that's the first array*/
237 str << " impl_arrstart=CK_ALIGN(implP.size(),16);\n";
238 str << " impl_off+=impl_arrstart;\n";
239 } else /*No arrays--no padding*/
240 str << " impl_off+=implP.size();\n";
242 // Now that we know the size, allocate the packing buffer
243 if (hasConditional())
244 str << " MarshallMsg_" << entry << " *impl_msg=CkAllocateMarshallMsgT<MarshallMsg_"
245 << entry << ">(impl_off,impl_e_opts);\n";
247 str << " CkMarshallMsg *impl_msg=CkAllocateMarshallMsg(impl_off,impl_e_opts);\n";
248 // Second pass: write the data
249 str << " { //Copy over the PUP'd data\n";
250 str << " PUP::toMem implP((void *)impl_msg->msgBuf);\n";
252 str << "#if CMK_ONESIDED_IMPL\n";
253 str << " implP|impl_num_rdma_fields;\n";
254 callEach(&Parameter::pupRdma, str, true);
256 callEach(&Parameter::pupRdma, str, false);
259 callEach(&Parameter::pup, str);
260 callEach(&Parameter::copyPtr, str);
262 if (hasArrays) { // Marshall each array
263 str << " char *impl_buf=impl_msg->msgBuf+impl_arrstart;\n";
264 callEach(&Parameter::marshallArrayData, str);
267 str << "#if CMK_ONESIDED_IMPL\n";
268 str << " UsrToEnv(impl_msg)->setRdma(true);\n";
270 if (!hasArrays) str << " char *impl_buf=impl_msg->msgBuf+impl_arrstart;\n";
271 callEach(&Parameter::marshallRdmaArrayData, str);
277 void Parameter::check() {
278 Type* dt = type->deref();
282 void Parameter::checkPointer(Type* dt) {
285 "can't pass pointers across processors--\n"
286 "Indicate the array length with []'s, or pass a reference",
290 void Parameter::marshallArraySizes(XStr& str, Type* dt) {
291 str << " int impl_off_" << name << ", impl_cnt_" << name << ";\n";
292 str << " impl_off_" << name << "=impl_off=CK_ALIGN(impl_off,sizeof(" << dt << "));\n";
293 str << " impl_off+=(impl_cnt_" << name << "=sizeof(" << dt << ")*(" << arrLen
297 void Parameter::marshallRegArraySizes(XStr& str) {
298 Type* dt = type->deref();
299 if (isArray()) marshallArraySizes(str, dt);
302 void Parameter::marshallRdmaParameters(XStr& str, bool genRdma) {
304 Type* dt = type->deref(); // Type, without &
306 str << " impl_num_rdma_fields++;\n";
307 str << " rdmawrapper_" << name << ".cnt=sizeof(" << dt << ")*(" << arrLen
310 marshallArraySizes(str, dt);
315 void Parameter::pupRdma(XStr& str, bool genRdma) {
318 str << " implP|rdmawrapper_" << name << ";\n";
324 void Parameter::pupArray(XStr& str) {
325 str << " implP|impl_off_" << name << ";\n";
326 str << " implP|impl_cnt_" << name << ";\n";
329 void Parameter::pup(XStr& str) {
332 } else if (!conditional) {
334 str << " //Have to cast away const-ness to get pup routine\n";
335 str << " implP|(typename std::remove_cv<typename std::remove_reference<" << type << ">::type>::type &)" << name << ";\n";
336 } else if (!isRdma())
337 str << " implP|" << name << ";\n";
341 void Parameter::marshallRdmaArrayData(XStr& str) {
343 str << " memcpy(impl_buf+impl_off_" << name << ","
344 << "rdmawrapper_" << name << ".ptr"
345 << ",impl_cnt_" << name << ");\n";
346 str << " rdmawrapper_" << name << ".callback->send("
349 << "&rdmawrapper_" << name << ".ptr"
351 str << " free(rdmawrapper_" << name << ".callback);\n";
355 void Parameter::marshallArrayData(XStr& str) {
357 str << " memcpy(impl_buf+impl_off_" << name << "," << name << ",impl_cnt_" << name
361 void Parameter::copyPtr(XStr& str) {
362 if (isConditional()) {
363 str << " impl_msg->" << name << "=" << name << ";\n";
367 void ParamList::beginRednWrapperUnmarshall(XStr& str, bool needsClosure) {
369 str << *entry->genClosureTypeNameProxyTemp << "*"
370 << " genClosure = new " << *entry->genClosureTypeNameProxyTemp << "()"
374 if (isMarshalled()) {
375 str << " /*Unmarshall pup'd fields: ";
378 str << " PUP::fromMem implP(impl_buf);\n";
379 if (next != NULL && next->next == NULL) {
380 // 2 argument case - special cases for an array and its length, in either order
381 if (isArray() && !next->isArray()) {
383 Type* dtLen = next->param->type->deref();
384 str << " PUP::detail::TemporaryObjectHolder<" << dtLen << "> "
385 << next->param->name << "; " << next->param->name << ".t = "
386 << "((CkReductionMsg*)impl_msg)->getLength() / sizeof("
387 << param->type->deref() << ");\n";
388 Type* dt = param->type->deref();
389 str << " " << dt << "* " << param->name << "; " << param->name << " = (" << dt
392 str << " genClosure->" << next->param->name << " = "
393 << "((CkReductionMsg*)impl_msg)->getLength() / sizeof("
394 << param->type->deref() << ");\n";
395 Type* dt = param->type->deref();
396 str << " genClosure->" << param->name << " = (" << dt << "*)impl_buf;\n";
398 } else if (!isArray() && next->isArray()) {
400 Type* dt = param->type->deref();
401 str << " PUP::detail::TemporaryObjectHolder<" << dt << "> " << param->name
402 << "; " << param->name << ".t = "
403 << "((CkReductionMsg*)impl_msg)->getLength() / sizeof("
404 << next->param->type->deref() << ");\n";
405 dt = next->param->type->deref();
406 str << " " << dt << "* " << next->param->name << "; " << next->param->name
407 << " = (" << dt << "*)impl_buf;\n";
409 str << " genClosure->" << param->name << " = "
410 << "((CkReductionMsg*)impl_msg)->getLength() / sizeof("
411 << next->param->type->deref() << ");\n";
412 Type* dt = next->param->type->deref();
413 str << " genClosure->" << next->param->name << " = (" << dt << "*)impl_buf;\n";
418 str << "#if CMK_ONESIDED_IMPL\n";
419 str << " CkUnpackRdmaPtrs(impl_buf);\n";
420 str << " int impl_num_rdma_fields; implP|impl_num_rdma_fields;\n";
421 callEach(&Parameter::beginUnmarshallRdma, str, true);
423 callEach(&Parameter::beginUnmarshallRdma, str, false);
426 callEach(&Parameter::beginUnmarshall, str);
429 str << "#if CMK_ONESIDED_IMPL\n";
430 str << " CkUnpackRdmaPtrs(impl_buf);\n";
431 callEach(&Parameter::beginUnmarshallSDAGCallRdma, str, true);
433 callEach(&Parameter::beginUnmarshallSDAGCallRdma, str, false);
436 callEach(&Parameter::beginUnmarshallSDAGCall, str);
439 } else if (next == NULL && isArray()) {
440 // 1 argument case - special case for a standalone array
441 Type* dt = param->type->deref();
443 str << " " << dt << "* " << param->name << "; " << param->name << " = (" << dt
446 str << " genClosure->" << param->name << " = (" << dt << "*)impl_buf;\n";
449 str << " /* non two-param case */\n";
452 str << "#if CMK_ONESIDED_IMPL\n";
453 str << " CkUnpackRdmaPtrs(impl_buf);\n";
454 str << " int impl_num_rdma_fields; implP|impl_num_rdma_fields;\n";
455 callEach(&Parameter::beginUnmarshallRdma, str, true);
457 callEach(&Parameter::beginUnmarshallRdma, str, false);
460 callEach(&Parameter::beginUnmarshall, str);
462 callEach(&Parameter::beginUnmarshallSDAGCall, str);
463 str << " impl_buf+=CK_ALIGN(implP.size(),16);\n";
464 str << " /*Unmarshall arrays:*/\n";
466 callEach(&Parameter::unmarshallRegArrayData, str);
468 callEach(&Parameter::unmarshallRegArrayDataSDAGCall, str);
472 str << " genClosure->setRefnum(CkGetRefNum((CkReductionMsg*)impl_msg));\n";
476 /** unmarshalling: unpack fields from flat buffer **/
477 void ParamList::beginUnmarshall(XStr& str) {
478 if (isMarshalled()) {
479 str << " /*Unmarshall pup'd fields: ";
482 str << " PUP::fromMem implP(impl_buf);\n";
484 str << "#if CMK_ONESIDED_IMPL\n";
485 str << " CkUnpackRdmaPtrs(impl_buf);\n";
486 str << " int impl_num_rdma_fields; implP|impl_num_rdma_fields; \n";
487 callEach(&Parameter::beginUnmarshallRdma, str, true);
489 callEach(&Parameter::beginUnmarshallRdma, str, false);
492 callEach(&Parameter::beginUnmarshall, str);
493 str << " impl_buf+=CK_ALIGN(implP.size(),16);\n";
494 str << " /*Unmarshall arrays:*/\n";
495 callEach(&Parameter::unmarshallRegArrayData, str);
497 str << "#if !CMK_ONESIDED_IMPL\n";
498 callEach(&Parameter::unmarshallRdmaArrayData, str, true);
504 void Parameter::beginUnmarshallArray(XStr& str) {
505 str << " int impl_off_" << name << ", impl_cnt_" << name << ";\n";
506 str << " implP|impl_off_" << name << ";\n";
507 str << " implP|impl_cnt_" << name << ";\n";
510 void Parameter::beginUnmarshallRdma(XStr& str,
511 bool genRdma) { // First pass: unpack pup'd entries
512 Type* dt = type->deref(); // Type, without &
515 str << " CkRdmaWrapper rdmawrapper_" << name << ";\n";
516 str << " implP|rdmawrapper_" << name << ";\n";
518 beginUnmarshallArray(str);
522 void Parameter::beginUnmarshall(XStr& str) { // First pass: unpack pup'd entries
523 Type* dt = type->deref(); // Type, without &
525 beginUnmarshallArray(str);
526 else if (isConditional())
527 str << " " << dt << " *" << name << "=impl_msg_typed->" << name << ";\n";
529 str << " PUP::detail::TemporaryObjectHolder<" << dt << "> " << name << ";\n"
531 << "implP|" << name << ";\n";
534 void Parameter::beginUnmarshallSDAGCallRdma(XStr& str, bool genRdma) {
538 str << " implP|genClosure->num_rdma_fields;\n";
540 str << " implP|genClosure->rdmawrapper_" << name << ";\n";
542 beginUnmarshallArray(str);
547 void Parameter::beginUnmarshallSDAGCall(XStr& str) {
548 Type* dt = type->deref();
550 beginUnmarshallArray(str);
551 } else if (isRdma()) {
552 // unmarshalled before regular parameters
554 str << " implP|" << (podType ? "" : "*") << "genClosure->" << name << ";\n";
558 /** unmarshalling: unpack fields from flat buffer **/
559 void ParamList::beginUnmarshallSDAGCall(XStr& str, bool usesImplBuf) {
560 bool hasArray = false;
561 for (ParamList* pl = this; pl != NULL; pl = pl->next) {
562 hasArray = hasArray || pl->param->isArray();
565 if (isMarshalled()) {
566 str << " PUP::fromMem implP(impl_buf);\n";
567 str << " " << *entry->genClosureTypeNameProxyTemp << "*"
568 << " genClosure = new " << *entry->genClosureTypeNameProxyTemp << "()"
571 str << "#if CMK_ONESIDED_IMPL\n";
572 str << " CkUnpackRdmaPtrs(impl_buf);\n";
573 callEach(&Parameter::beginUnmarshallSDAGCallRdma, str, true);
575 callEach(&Parameter::beginUnmarshallSDAGCallRdma, str, false);
578 callEach(&Parameter::beginUnmarshallSDAGCall, str);
579 str << " impl_buf+=CK_ALIGN(implP.size(),16);\n";
580 if (hasRdma()) str << "#if !CMK_ONESIDED_IMPL\n";
581 callEach(&Parameter::unmarshallRdmaArrayDataSDAGCall, str);
582 if (hasRdma()) str << "#endif\n";
583 callEach(&Parameter::unmarshallRegArrayDataSDAGCall, str);
584 if (hasArray || hasRdma()) {
586 str << " genClosure->_impl_marshall = impl_msg_typed;\n";
587 str << " CmiReference(UsrToEnv(genClosure->_impl_marshall));\n";
589 if (hasRdma() && !hasArray) str << "#if !CMK_ONESIDED_IMPL\n";
590 str << " genClosure->_impl_buf_in = impl_buf;\n";
591 str << " genClosure->_impl_buf_size = implP.size();\n";
592 if (hasRdma() && !hasArray) str << "#endif\n";
597 void ParamList::beginUnmarshallSDAG(XStr& str) {
598 if (isMarshalled()) {
599 str << " PUP::fromMem implP(impl_buf);\n";
601 str << "#if CMK_ONESIDED_IMPL\n";
602 /* Before migration of the closure structure, Rdmawrapper pointers
603 * store the offset to the actual buffer from the msgBuf
604 * After migration, the Rdmawrapper pointer needs to be adjusted
605 * to point to the msgBuf + offset. As the actual buffer is within
606 * the message, the adjusting should happen after the message is
607 * unpacked. (see code in Entry::genClosure)
609 callEach(&Parameter::adjustUnmarshalledRdmaPtrsSDAG, str);
610 str << " implP|num_rdma_fields;\n";
611 callEach(&Parameter::beginUnmarshallRdma, str, true);
613 callEach(&Parameter::beginUnmarshallRdma, str, false);
616 callEach(&Parameter::beginUnmarshall, str);
617 str << " impl_buf+=CK_ALIGN(implP.size(),16);\n";
618 // If there's no rdma support, unmarshall as a regular array
619 str << "#if !CMK_ONESIDED_IMPL\n";
620 callEach(&Parameter::unmarshallRdmaArrayDataSDAG, str);
622 callEach(&Parameter::unmarshallRegArrayDataSDAG, str);
626 void Parameter::unmarshallRegArrayDataSDAG(XStr& str) {
628 Type* dt = type->deref(); // Type, without &
629 str << " " << name << " = (" << dt << " *)(impl_buf+impl_off_" << name
634 void Parameter::adjustUnmarshalledRdmaPtrsSDAG(XStr& str) {
636 str << " rdmawrapper_" << name << ".ptr = ";
637 str << "(void *)(impl_buf + (size_t)(rdmawrapper_" << name << ".ptr));\n";
641 void Parameter::unmarshallRdmaArrayDataSDAG(XStr& str) {
643 Type* dt = type->deref(); // Type, without &
644 str << " " << name << " = (" << dt << " *)(impl_buf+impl_off_" << name
649 void Parameter::unmarshallRegArrayDataSDAGCall(XStr& str) {
651 Type* dt = type->deref(); // Type, without &
652 str << " genClosure->" << name << " = (" << dt << " *)(impl_buf+impl_off_" << name
657 void Parameter::unmarshallRdmaArrayDataSDAGCall(XStr& str) {
659 Type* dt = type->deref(); // Type, without &
660 str << " genClosure->" << name << " = (" << dt << " *)(impl_buf+impl_off_" << name
665 void ParamList::unmarshallSDAGCall(XStr& str, int isFirst) {
666 if (isFirst && isMessage())
667 str << "(" << param->type << ")impl_msg";
668 else if (!isVoid()) {
669 str << "genClosure->";
670 str << param->getName();
673 next->unmarshallSDAGCall(str, 0);
678 void Parameter::unmarshallArrayData(XStr& str) {
679 Type* dt = type->deref(); // Type, without &
680 str << " " << dt << " *" << name << "=(" << dt << " *)(impl_buf+impl_off_" << name
684 void Parameter::unmarshallRdmaArrayData(XStr& str, bool genRegArray) {
685 if (isRdma() && genRegArray) unmarshallArrayData(str);
688 void Parameter::unmarshallRegArrayData(
689 XStr& str) { // Second pass: unpack pointed-to arrays
690 if (isArray()) unmarshallArrayData(str);
693 void ParamList::unmarshall(XStr& str, bool isInline, bool isFirst) // Pass-by-value
695 if (isFirst && isMessage())
696 str << "(" << param->type << ")impl_msg";
697 else if (!isVoid()) {
698 if (param->isRdma()) {
699 str << "\n#if CMK_ONESIDED_IMPL\n";
700 str << "(" << (param->getType())->deref() << " *)";
701 str << "rdmawrapper_" << param->getName() << ".ptr";
703 str << param->getName();
705 } else if (param->isArray() || isInline) {
706 str << param->getName();
708 str << "std::move(" << param->getName() << ".t)";
713 next->unmarshall(str, isInline, false);
718 // Do forwarding for rvalue references, used for inline and local entry methods
719 void ParamList::unmarshallForward(XStr& str,
725 unmarshall(str, isInline, isFirst);
727 str << "std::forward<Fwd" << fwdNum++ << ">(" << param->getName() << ")";
730 next->unmarshallForward(str, isInline, false, fwdNum);
733 unmarshall(str, isInline, isFirst);
737 void ParamList::unmarshallAddress(XStr& str,
738 int isFirst) // Pass-by-reference, for Fortran
740 if (isFirst && isMessage())
741 str << "(" << param->type << ")impl_msg";
742 else if (!isVoid()) {
743 //@TODO : Case for RDMA
744 if (param->isArray())
745 str << param->getName(); // Arrays are already pointers
747 str << "& " << param->getName() << ".t"; // Take address of simple types and structs
750 next->unmarshallAddress(str, 0);
755 void ParamList::pupAllValues(XStr& str) {
756 if (isMarshalled()) callEach(&Parameter::pupAllValues, str);
759 void Parameter::pupAllValues(XStr& str) {
760 str << " if (implDestP.hasComments()) implDestP.comment(\"" << name << "\");\n";
762 str << " implDestP.synchronize(PUP::sync_begin_array);\n"
763 " for (int impl_i=0;impl_i*(sizeof(*"
764 << name << "))<impl_cnt_" << name
766 " implDestP.synchronize(PUP::sync_item);\n"
771 " implDestP.synchronize(PUP::sync_end_array);\n";
772 } else if (isRdma()) {
773 str << "#if CMK_ONESIDED_IMPL\n";
774 str << " implDestP|rdmawrapper_" << name << ";\n";
776 str << " implDestP.synchronize(PUP::sync_begin_array);\n"
777 " { for (int impl_i=0;impl_i*(sizeof(*"
778 << name << "))<impl_cnt_" << name
780 " implDestP.synchronize(PUP::sync_item);\n"
785 " implDestP.synchronize(PUP::sync_end_array);\n";
787 } else /* not an array */ {
789 str << " pup_pointer(&implDestP, (void**)&" << name << ");\n";
791 str << " implDestP|" << name << ";\n";
795 void ParamList::endUnmarshall(XStr&) {
796 /* Marshalled entry points now have the "SNOKEEP" attribute...
797 if (isMarshalled()) {
798 str<<" delete (CkMarshallMsg *)impl_msg;\n";
803 void ParamList::printMsg(XStr& str) {
805 param->printMsg(str);
809 pl->param->printMsg(str);
814 void Parameter::printMsg(XStr& str) {
816 if (given_name != 0) str << given_name;
819 int Parameter::isMessage(void) const { return type->isMessage(); }
820 int Parameter::isVoid(void) const { return type->isVoid(); }
821 int Parameter::isCkArgMsgPtr(void) const { return type->isCkArgMsgPtr(); }
822 int Parameter::isCkMigMsgPtr(void) const { return type->isCkMigMsgPtr(); }
823 int Parameter::isArray(void) const { return (arrLen != NULL && !isRdma()); }
824 int Parameter::isConditional(void) const { return conditional; }
825 int Parameter::isRdma(void) const { return rdma; }
826 int Parameter::isFirstRdma(void) const { return firstRdma; }
828 int Parameter::operator==(const Parameter& parm) const { return *type == *parm.type; }
830 void Parameter::setConditional(int c) {
832 if (c) byReference = false;
835 void Parameter::setRdma(bool r) { rdma = r; }
837 void Parameter::setFirstRdma(bool fr) { firstRdma = fr; }
839 void Parameter::setAccelBufferType(int abt) {
840 accelBufferType = ((abt < ACCEL_BUFFER_TYPE_MIN || abt > ACCEL_BUFFER_TYPE_MAX)
841 ? (ACCEL_BUFFER_TYPE_UNKNOWN)
845 int Parameter::getAccelBufferType() { return accelBufferType; }
846 void Parameter::setAccelInstName(XStr* ain) { accelInstName = ain; }
847 XStr* Parameter::getAccelInstName(void) { return accelInstName; }
849 ParamList::ParamList(Parameter* Nparam, ParamList* Nnext) : param(Nparam), next(Nnext) {
850 manyPointers = false;
851 if (next != NULL && (param->isMessage() || next->isMessage())) {
856 int ParamList::isNamed(void) const { return param->type->isNamed(); }
857 int ParamList::isBuiltin(void) const { return param->type->isBuiltin(); }
858 int ParamList::isMessage(void) const { return (next == NULL) && param->isMessage(); }
859 int ParamList::hasRdma(void) { return orEach(&Parameter::isRdma); }
860 int ParamList::isRdma(void) { return param->isRdma(); }
861 int ParamList::isFirstRdma(void) { return param->isFirstRdma(); }
862 const char* ParamList::getArrayLen(void) const { return param->getArrayLen(); }
863 int ParamList::isArray(void) const { return param->isArray(); }
864 int ParamList::isReference(void) const {
865 return param->type->isReference() || param->byReference;
867 int ParamList::declaredReference(void) const {
868 return param->type->isReference() || param->declaredReference;
870 bool ParamList::isConst(void) const { return param->type->isConst() || param->byConst; }
871 int ParamList::isVoid(void) const { return (next == NULL) && param->isVoid(); }
872 int ParamList::isPointer(void) const { return param->type->isPointer(); }
873 const char* ParamList::getGivenName(void) const { return param->getGivenName(); }
874 void ParamList::setGivenName(const char* s) { param->setGivenName(s); }
875 const char* ParamList::getName(void) const { return param->getName(); }
876 int ParamList::isMarshalled(void) const { return !isVoid() && !isMessage(); }
877 int ParamList::isCkArgMsgPtr(void) const {
878 return (next == NULL) && param->isCkArgMsgPtr();
880 int ParamList::isCkMigMsgPtr(void) const {
881 return (next == NULL) && param->isCkMigMsgPtr();
883 int ParamList::getNumStars(void) const { return param->type->getNumStars(); }
884 const char* ParamList::getBaseName(void) { return param->type->getBaseName(); }
885 void ParamList::genMsgProxyName(XStr& str) { param->type->genMsgProxyName(str); }
887 void ParamList::checkParamList() {
890 "multiple pointers passed to a non-local entry method\n"
891 "You may pass only a single pointer to it, which should point to a message.",
896 int ParamList::operator==(ParamList& plist) {
897 if (!(*param == *(plist.param))) return 0;
898 if (!next && !plist.next) return 1;
899 if (!next || !plist.next) return 0;
900 return *next == *plist.next;