Fixed some portability bugs due to varying integer and pointer sizes.
authorMilind Bhandarkar <milind@cs.uiuc.edu>
Wed, 26 Nov 1997 19:17:24 +0000 (19:17 +0000)
committerMilind Bhandarkar <milind@cs.uiuc.edu>
Wed, 26 Nov 1997 19:17:24 +0000 (19:17 +0000)
src/conv-core/converse.h
src/scripts/charmc
src/xlatcpm/conv-cpm.c
src/xlatcpm/conv-cpm.flex

index 9d946f2f9ff1ac02cfe955ecd284518e6e76a52d..18bae30e910fe86306ffc38e86351a73f03cf531 100644 (file)
  * REVISION HISTORY:
  *
  * $Log$
- * Revision 2.74  1997-10-29 18:47:05  jyelon
+ * Revision 2.75  1997-11-26 19:17:24  milind
+ * Fixed some portability bugs due to varying integer and pointer sizes.
+ *
+ * Revision 2.74  1997/10/29 18:47:05  jyelon
  * Added CmiHandlerToFunction
  *
  * Revision 2.73  1997/07/31 00:28:25  jyelon
@@ -271,6 +274,54 @@ extern void         CmiDestroyLock(CmiNodeLock lock);
 
 #endif
 
+#if CMK_SHARED_VARS_PTHREADS
+
+#include <pthread.h>
+#include <sched.h>
+
+extern int CmiMyPe();
+extern int Cmi_numpes;
+
+#define CmiNumPes()            Cmi_numpes
+#define CmiMyRank()            CmiMyPe()
+#define CmiMyNodeSize()        Cmi_numpes
+#define CmiMyNode()            0
+#define CmiNumNodes()          1
+#define CmiNodeFirst(node)     0
+#define CmiNodeSize(node)      Cmi_numpes
+#define CmiNodeOf(pe)          0
+#define CmiRankOf(pe)          (pe)
+
+#define SHARED_DECL
+
+#define CpvDeclare(t,v) t* CMK_CONCAT(Cpv_Var_,v)
+#define CpvExtern(t,v)  extern t* CMK_CONCAT(Cpv_Var_,v)
+#define CpvStaticDeclare(t,v) static t* CMK_CONCAT(Cpv_Var_,v)
+#define CpvInitialize(t,v)\
+  { if (CmiMyRank()) while (CMK_CONCAT(Cpv_Var_,v)==0) sched_yield();\
+    else { CMK_CONCAT(Cpv_Var_,v)=(t*)CmiAlloc(sizeof(t)*CmiMyNodeSize()); }}
+#define CpvAccess(v) CMK_CONCAT(Cpv_Var_,v)[CmiMyRank()]
+
+#define CsvDeclare(t,v) t CMK_CONCAT(Csv_Var_,v)
+#define CsvStaticDeclare(t,v) static t CMK_CONCAT(Csv_Var_,v)
+#define CsvExtern(t,v) extern t CMK_CONCAT(Csv_Var_,v)
+#define CsvInitialize(t,v)
+#define CsvAccess(v) CMK_CONCAT(Csv_Var_,v)
+
+extern void CmiMemLock();
+extern void CmiMemUnlock();
+extern void CmiNodeBarrier();
+#define CmiSvAlloc CmiAlloc
+
+typedef pthread_mutex_t *CmiNodeLock;
+extern CmiNodeLock  CmiCreateLock(void);
+extern void         CmiLock(CmiNodeLock lock);
+extern void         CmiUnlock(CmiNodeLock lock);
+extern int          CmiTryLock(CmiNodeLock lock);
+extern void         CmiDestroyLock(CmiNodeLock lock);
+
+#endif
+
 /******** CMI: TYPE DEFINITIONS ********/
 
 #define CmiMsgHeaderSizeBytes CMK_MSG_HEADER_SIZE_BYTES
index 627675dc76251d5419b851fe9e24c5f17da395b9..cc34c7b7c2ad27881df68100c18aeaf994379971 100755 (executable)
@@ -723,7 +723,7 @@ if (($LANGUAGE == charm) || ($LANGUAGE == charm++)) then
                       $BAL_OBJ $OBJECTFILES $LIBRARIES \
                      CHARMC-MOD.TMP.o -lck-core -lck-trace-$TRACEMODE \
                       -lck-cplus-n -lconv-cplus-n -lconv-core \
-                     -lck-defmain-std -lcharm $CMK_LIBS -lm)
+                     -lck-defmain-std -lcharm -lm $CMK_LIBS)
     else if ($LANGUAGE == charm++) then
        echo '_CK_module_init_fn() {}' > CHARMC-MOD.TMP.c
        ($ECHOCMD ; $CMK_CC $OPTS_CC -c -o CHARMC-MOD.TMP.o CHARMC-MOD.TMP.c)
@@ -731,7 +731,7 @@ if (($LANGUAGE == charm) || ($LANGUAGE == charm++)) then
                      $BAL_OBJ $OBJECTFILES $LIBRARIES \
                      CHARMC-MOD.TMP.o -lck-core -lck-trace-$TRACEMODE \
                       -lck-cplus-y -lconv-cplus-y -lconv-core \
-                     -lck-defmain-cpp -lcharm $CMK_LIBS -lm)
+                     -lck-defmain-cpp -lcharm -lm $CMK_LIBS)
     endif
     rm -f CHARMC-PRE.TMP.nm
     strings -a CHARMC-PRE.TMP.xxx | awk '/^charmc autoinit / { print $3; }' > CHARMC-PRE.TMP.nm
@@ -759,26 +759,26 @@ switch ($LANGUAGE)
                       CHARMC-MOD.TMP.o $BAL_OBJ $OBJECTFILES \
                       $LIBRARIES -lck-core -lck-trace-$TRACEMODE \
                       -lck-cplus-n -lconv-cplus-n -lconv-core \
-                     -lck-defmain-std -lcharm $CMK_LIBS -lm)
+                     -lck-defmain-std -lcharm -lm $CMK_LIBS)
         breaksw
     case "charm++"
         ($ECHOCMD ; $CMK_LDXX $OPTS_LDXX -o $OBJECT -L$CHARMLIB \
                      CHARMC-MOD.TMP.o $BAL_OBJ $OBJECTFILES \
                       $LIBRARIES -lck-core -lck-trace-$TRACEMODE \
                       -lck-cplus-y -lconv-cplus-y -lconv-core \
-                     -lck-defmain-cpp -lcharm $CMK_LIBS -lm)
+                     -lck-defmain-cpp -lcharm -lm $CMK_LIBS)
         breaksw
     case "converse"
         ($ECHOCMD ; $CMK_LD $OPTS_LD -o $OBJECT -L$CHARMLIB \
                      $OBJECTFILES $LIBRARIES -lconv-cplus-n -lconv-core\
                      -lck-trace-$TRACEMODE \
-                     $CMK_LIBS -lm)
+                     -lm $CMK_LIBS)
         breaksw
     case "converse++"
         ($ECHOCMD ; $CMK_LDXX $OPTS_LDXX -o $OBJECT -L$CHARMLIB \
                      $OBJECTFILES $LIBRARIES -lconv-cplus-y -lconv-core \
                      -lck-trace-$TRACEMODE \
-                     $CMK_LIBS -lm)
+                     -lm $CMK_LIBS)
         breaksw
 endsw
 
index e04a4c922dc32775117a2fd204a89e9f92728176..f1598c06ed3300a483f495c5807ebd1a6f265ec8 100644 (file)
@@ -1869,7 +1869,7 @@ void gen_func_recv()
        gen_dimension_required();
       fprintf(file_cpm, "CpmA%d = (%s *)(CpmX+(CpmS->f%d));\n", i, func_args[i], i);
       fprintf(file_cpm, "for (i=0; i<CpmA%d; i++) {\n", i-1);
-      fprintf(file_cpm, "  CpmA%d[i] = CpmM + (unsigned int)(CpmA%d[i]);\n", i, i);
+      fprintf(file_cpm, "  CpmA%d[i] = CpmM + (size_t)(CpmA%d[i]);\n", i, i);
       fprintf(file_cpm, "  CpmPtrUnpack_%s(CpmA%d[i]);\n", func_args[i], i);
       fprintf(file_cpm, "}\n");
       break;
index 8b5c8f6f5f0c7afa9d99473160213831c10f63db..811523491069ebb8aa9108f8803870f965163194 100644 (file)
@@ -199,7 +199,7 @@ void gen_func_recv()
        gen_dimension_required();
       fprintf(file_cpm, "CpmA%d = (%s *)(CpmX+(CpmS->f%d));\n", i, func_args[i], i);
       fprintf(file_cpm, "for (i=0; i<CpmA%d; i++) {\n", i-1);
-      fprintf(file_cpm, "  CpmA%d[i] = CpmM + (unsigned int)(CpmA%d[i]);\n", i, i);
+      fprintf(file_cpm, "  CpmA%d[i] = CpmM + (size_t)(CpmA%d[i]);\n", i, i);
       fprintf(file_cpm, "  CpmPtrUnpack_%s(CpmA%d[i]);\n", func_args[i], i);
       fprintf(file_cpm, "}\n");
       break;