Segfault fix in prefetch queue + additional macros for debugging
authoradash <adash>
Thu, 24 Jul 2008 21:22:20 +0000 (21:22 +0000)
committeradash <adash>
Thu, 24 Jul 2008 21:22:20 +0000 (21:22 +0000)
Robust/src/Runtime/DSTM/interface/dstm.h
Robust/src/Runtime/DSTM/interface/queue.c
Robust/src/Runtime/DSTM/interface/queue.h
Robust/src/Runtime/DSTM/interface/sockpool.c

index abfcae6b3a2bb5715399cf394f28fc8e6de50afd..c97787c34535981f0279f50d368aaef0fb586231 100644 (file)
@@ -12,6 +12,8 @@
 #define GET_PTR_OID(x)         ((unsigned int *)(x + sizeof(int)))
 #define GET_PTR_EOFF(x,n) ((short *)(x + sizeof(int) + (n*sizeof(unsigned int))))
 #define GET_PTR_ARRYFLD(x,n) ((short *)(x + sizeof(int) + (n*sizeof(unsigned int)) + (n*sizeof(short))))
 #define GET_PTR_OID(x)         ((unsigned int *)(x + sizeof(int)))
 #define GET_PTR_EOFF(x,n) ((short *)(x + sizeof(int) + (n*sizeof(unsigned int))))
 #define GET_PTR_ARRYFLD(x,n) ((short *)(x + sizeof(int) + (n*sizeof(unsigned int)) + (n*sizeof(short))))
+#define ENDEBUG(s) { printf("Inside %s()\n", s); fflush(stdout);}
+#define EXDEBUG(s) {printf("Outside %s()\n", s); fflush(stdout);}
 /*****************************************
  *  Coordinator Messages
  ***************************************/
 /*****************************************
  *  Coordinator Messages
  ***************************************/
@@ -77,6 +79,7 @@
 #include <time.h>
 #include "sockpool.h"
 #include "prelookup.h"
 #include <time.h>
 #include "sockpool.h"
 #include "prelookup.h"
+#include <signal.h>
 
 //bit designations for status field of objheader
 #define DIRTY 0x01
 
 //bit designations for status field of objheader
 #define DIRTY 0x01
@@ -84,6 +87,9 @@
 #define LOCK  0x04
 #define LOCAL  0x08
 
 #define LOCK  0x04
 #define LOCAL  0x08
 
+/*******Global statistics *********/
+extern int numprefetchsites;
+
 #ifdef COMPILER
 
 #include "structdefs.h"
 #ifdef COMPILER
 
 #include "structdefs.h"
@@ -283,6 +289,7 @@ prefetchpile_t *foundLocal(char *);// returns node with prefetch elements(oids,
 int lookupObject(unsigned int * oid, short offset);
 int transPrefetchProcess(transrecord_t *, int **, short);
 void sendPrefetchReq(prefetchpile_t*, int);
 int lookupObject(unsigned int * oid, short offset);
 int transPrefetchProcess(transrecord_t *, int **, short);
 void sendPrefetchReq(prefetchpile_t*, int);
+void sendPrefetchReqnew(prefetchpile_t*, int);
 int getPrefetchResponse(int);
 unsigned short getObjType(unsigned int oid);
 int startRemoteThread(unsigned int oid, unsigned int mid);
 int getPrefetchResponse(int);
 unsigned short getObjType(unsigned int oid);
 int startRemoteThread(unsigned int oid, unsigned int mid);
index 38434dc61c8a14e6f736df9ad8085ec6f8c2a13f..9f2eb419b9ff96791c3e820838a70589182ce72e 100644 (file)
@@ -28,15 +28,15 @@ void * getmemory(int size) {
     while(headoffset<tailoffset)
       ;
     //Wait for tail to go past new start
     while(headoffset<tailoffset)
       ;
     //Wait for tail to go past new start
-    while(tailoffset<tmpoffset)
+    while(tailoffset<=tmpoffset)
       ;
     *((int *)(memory+headoffset))=-1;//safe because we left space
     *((int*)memory)=size+sizeof(int);
     return memory+sizeof(int);
   } else {
       ;
     *((int *)(memory+headoffset))=-1;//safe because we left space
     *((int*)memory)=size+sizeof(int);
     return memory+sizeof(int);
   } else {
-    while(headoffset<tailoffset&&tailoffset<tmpoffset)
+    while(headoffset<tailoffset&&tailoffset<=tmpoffset)
       ;
       ;
-     *((int*)(memory+headoffset))=size+sizeof(int);
+    *((int*)(memory+headoffset))=size+sizeof(int);
     return memory+headoffset+sizeof(int);
   }
 }
     return memory+headoffset+sizeof(int);
   }
 }
index d8a751fdaca5dd9db5082053c2090e1fa7058d12..fffeed15b44091cc6c5f56a425b51218a543949a 100644 (file)
@@ -5,6 +5,7 @@
 #include<stdlib.h>
 #include<pthread.h>
 #include<string.h>
 #include<stdlib.h>
 #include<pthread.h>
 #include<string.h>
+#include "dstm.h"
 
 void queueInit(void);
 void * getmemory(int size);
 
 void queueInit(void);
 void * getmemory(int size);
index fed260bba249686abbce9f8d52e1fb71e52d29b0..2cb2a2412039c5068f62c83e4b11cae6cc79ff1f 100644 (file)
@@ -70,6 +70,7 @@ int createNewSocket(unsigned int mid) {
   remoteAddr.sin_port = htons(LISTEN_PORT);
   remoteAddr.sin_addr.s_addr = htonl(mid);
   if(connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) {
   remoteAddr.sin_port = htons(LISTEN_PORT);
   remoteAddr.sin_addr.s_addr = htonl(mid);
   if(connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) {
+    perror("socket connect: ");
     printf("%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT);
     close(sd);
     return -1;
     printf("%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT);
     close(sd);
     return -1;