more changes to support range prefetching :
[IRC.git] / Robust / src / Runtime / DSTM / interface / prefetch.h
1 #include "queue.h"
2 #include "dstm.h"
3
4 #define GET_STRIDE(x) ((x & 0x7000) >> 12)
5 #define GET_RANGE(x) (x & 0x0fff)
6 #define GET_STRIDEINC(x) ((x & 0x8000) >> 15)
7
8 /****** Global structure **********/
9 typedef struct objOffsetPile {
10   unsigned int oid;
11   short numoffset;
12   short *offsets;
13   struct objOffsetPile *next;
14 } objOffsetPile_t;
15
16 typedef struct perMcPrefetchList {
17   unsigned int mid;
18   objOffsetPile_t *list;
19   struct perMcPrefetchList *next;
20 } perMcPrefetchList_t;
21
22 typedef struct proPrefetchQ {
23   perMcPrefetchList_t *front, *rear;
24   pthread_mutex_t qlock;
25   pthread_mutexattr_t qlockattr;
26   pthread_cond_t qcond;
27 } proPrefetchQ_t;
28
29 // Global Prefetch Processing Queue
30 proPrefetchQ_t prefetchQ;
31
32 /**** Prefetch Queue to be processed functions ******/
33 void proPrefetchQDealloc(perMcPrefetchList_t *);
34
35 /******** Process Queue Element functions ***********/
36 void rangePrefetch(int, int, unsigned int *, unsigned short *, short *offset);
37 void *transPrefetchNew();
38 perMcPrefetchList_t* checkIfLocal(char *ptr);
39 int isOidAvail(unsigned int oid);
40 int lookForObjs(int*, short *, int *, int *, int *);
41 void insertPrefetch(int, unsigned int, short, short*, perMcPrefetchList_t **); 
42 void sendRangePrefetchReq(perMcPrefetchList_t *, int sd);
43
44 /************* Internal functions *******************/
45 int getsize(short *ptr, int n);