#ifdef DMALLOC
#include "dmalloc.h"
#endif
-
+#ifdef DSTM
+#include "dstm.h"
+#endif
#define NUMPTRS 100
#ifdef TASK
extern struct genhashtable * activetasks;
+#ifndef MULTICORE
extern struct parameterwrapper * objectqueues[NUMCLASSES];
+#endif
extern struct genhashtable * failedtasks;
extern struct taskparamdescriptor *currtpd;
extern struct RuntimeHash *forward;
int listcount=0;
#endif
+//Need to check if pointers are transaction pointers
#ifdef DSTM
#define ENQUEUE(orig, dst) \
if ((!(((unsigned int)orig)&0x1))) {\
-if (orig>to_heapbase&&orig<to_heaptop) {\
-dst=NULL;\
-} else if (orig>curr_heapbase&&orig<curr_heaptop) {\
+if (orig>=curr_heapbase&&orig<curr_heaptop) {\
void *copy;\
if (gc_createcopy(orig,©))\
enqueue(orig);\
/* Update objectsets */
int i;
for(i=0;i<NUMCLASSES;i++) {
+#ifdef MULTICORE
+#else
struct parameterwrapper * p=objectqueues[i];
while(p!=NULL) {
struct ObjectHash * set=p->objectset;
ObjectHashrehash(set); /* Rehash the table */
p=p->next;
}
+#endif
}
}
if (pointer==0) {
/* Array of primitives */
/* Do nothing */
+#ifdef DSTM
+ struct ArrayObject *ao=(struct ArrayObject *) ptr;
+ struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy;
+ ENQUEUE((void *)ao->___nextobject___, *((void **)&ao_cpy->___nextobject___));
+ ENQUEUE((void *)ao->___localcopy___, *((void **)&ao_cpy->___localcopy___));
+#endif
} else if (((int)pointer)==1) {
/* Array of pointers */
struct ArrayObject *ao=(struct ArrayObject *) ptr;
struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy;
+#ifdef DSTM
+ ENQUEUE((void *)ao->___nextobject___, *((void **)&ao_cpy->___nextobject___));
+ ENQUEUE((void *)ao->___localcopy___, *((void **)&ao_cpy->___localcopy___));
+#endif
int length=ao->___length___;
int i;
for(i=0;i<length;i++) {
}
#if defined(THREADS)||defined(DSTM)
-
void checkcollect(void * ptr) {
if (needtocollect) {
struct listitem * tmp=stopforgc((struct garbagelist *)ptr);
}
}
+#ifdef DSTM
+void checkcollect2(void * ptr, transrecord_t *trans) {
+ if (needtocollect) {
+ int ptrarray[]={1, (int)ptr, (int) trans->revertlist};
+ struct listitem * tmp=stopforgc((struct garbagelist *)ptrarray);
+ pthread_mutex_lock(&gclock); // Wait for GC
+ restartaftergc(tmp);
+ pthread_mutex_unlock(&gclock);
+ trans->revertlist=(struct ___Object___*)ptrarray[2];
+ }
+}
+#endif
+
+
struct listitem * stopforgc(struct garbagelist * ptr) {
struct listitem * litem=malloc(sizeof(struct listitem));
litem->stackptr=ptr;