Found the bug in net-sol versions - 32 bit architectures have size_t as 32 bytes...
authorNikhil Jain <nikhil@illinois.edu>
Wed, 21 Dec 2011 01:36:03 +0000 (19:36 -0600)
committerNikhil Jain <nikhil@illinois.edu>
Wed, 21 Dec 2011 01:36:03 +0000 (19:36 -0600)
src/arch/util/mempool.h
src/conv-core/isomalloc.c

index dec9b073c02cb72202cfd7e6575a13cd5b141fa5..e97ab030e85e045b349ccc074a496664e952fac9 100644 (file)
@@ -12,7 +12,7 @@ typedef gni_mem_handle_t    mem_handle_t;
 #else
   // in uGNI, it is memory handler, other versions, this is an integer
   // a unique integer to represent the memory block
-typedef size_t    mem_handle_t;
+typedef CmiInt8   mem_handle_t;
 #endif
 
 typedef void * (* mempool_newblockfn)(size_t *size, mem_handle_t *mem_hndl, int expand_flag);
@@ -58,6 +58,7 @@ typedef struct block_header_
     size_t              size;
     size_t              block_next;     // offset to next memblock
     size_t              freelists[cutOffNum];
+    size_t          padding;    // fix for 32 bit machines
 } block_header;
 
 // only at beginning of first block of mempool
index 85106d1126c5096ece66c82c5f8082478d2b6c20..6a244b026d01d200828cbd0e4f8ca00cd60771cd 100644 (file)
@@ -2545,7 +2545,8 @@ void CmiIsomallocBlockListPup(pup_er p,CmiIsomallocBlockList **lp, CthThread tid
   block_header *current, *block_head;
   slot_header *currSlot;
   void *newblock;
-  CmiInt8 slot,size;
+  CmiInt8 slot;
+  size_t size;
   int flags[2];
   int i, j;
   int numBlocks = 0, numSlots = 0, flag = 1;
@@ -2567,8 +2568,8 @@ void CmiIsomallocBlockListPup(pup_er p,CmiIsomallocBlockList **lp, CthThread tid
     pup_int(p,&numBlocks);
     current = &(CtvAccessOther(tid,threadpool)->block_head);
     while(current != NULL) {
-      pup_int8(p,&current->size);
-      pup_bytes(p,&current->mem_hndl,sizeof(CmiInt8));
+      pup_bytes(p,&current->size,sizeof(current->size));
+      pup_bytes(p,&current->mem_hndl,sizeof(current->mem_hndl));
       numSlots = 0;
       if(flag) {
         pup_bytes(p,current,sizeof(mempool_type));
@@ -2609,8 +2610,8 @@ void CmiIsomallocBlockListPup(pup_er p,CmiIsomallocBlockList **lp, CthThread tid
     printf("Number of blocks to be unpacked %d\n",numBlocks);
 #endif
     for(i = 0; i < numBlocks; i++) { 
-      pup_int8(p,&size);
-      pup_bytes(p,&slot,sizeof(CmiInt8));
+      pup_bytes(p,&size,sizeof(size));
+      pup_bytes(p,&slot,sizeof(slot));
       newblock = map_slots(slot,size/slotsize);
       if(flag) {
         pup_bytes(p,newblock,sizeof(mempool_type));