int listcount=0;
#endif
+#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) {\
+void *copy;\
+if (gc_createcopy(orig,©))\
+enqueue(orig);\
+dst=copy;\
+}\
+}
+#else
+#define ENQUEUE(orig, dst) \
+void *copy; \
+if (gc_createcopy(orig,©))\
+enqueue(orig);\
+dst=copy
+#endif
+
struct pointerblock {
void * ptrs[NUMPTRS];
struct pointerblock *next;
};
+void * curr_heapbase=0;
+void * curr_heapptr=0;
+void * curr_heapgcpoint=0;
+void * curr_heaptop=0;
+
+void * to_heapbase=0;
+void * to_heapptr=0;
+void * to_heaptop=0;
+long lastgcsize=0;
+
struct pointerblock *head=NULL;
int headindex=0;
struct pointerblock *tail=NULL;
int i;
for(i=0;i<stackptr->size;i++) {
void * orig=stackptr->array[i];
- void * copy;
- if (gc_createcopy(orig,©))
- enqueue(orig);
- stackptr->array[i]=copy;
+ ENQUEUE(orig, stackptr->array[i]);
}
stackptr=stackptr->next;
}
/* Go to next thread */
if (listptr!=NULL) {
void * orig=listptr->locklist;
- void * copy;
- if (gc_createcopy(orig,©))
- enqueue(orig);
- listptr->locklist=copy;
+ ENQUEUE(orig, listptr->locklist);
stackptr=listptr->stackptr;
listptr=listptr->next;
} else
struct ObjectNode * ptr=set->listhead;
while(ptr!=NULL) {
void *orig=(void *)ptr->key;
- void *copy;
- if (gc_createcopy(orig, ©))
- enqueue(orig);
- ptr->key=(int)copy;
-
+ ENQUEUE(orig, *((void **)(&ptr->key)));
ptr=ptr->lnext;
}
ObjectHashrehash(set); /* Rehash the table */
struct RuntimeNode * ptr=forward->listhead;
while(ptr!=NULL) {
void * orig=(void *)ptr->key;
- void *copy;
- if (gc_createcopy(orig, ©))
- enqueue(orig);
- ptr->key=(int)copy;
-
+ ENQUEUE(orig, *((void **)(&ptr->key)));
ptr=ptr->lnext;
}
RuntimeHashrehash(forward); /* Rehash the table */
struct RuntimeNode * ptr=reverse->listhead;
while(ptr!=NULL) {
void *orig=(void *)ptr->data;
- void *copy;
- if (gc_createcopy(orig, ©))
- enqueue(orig);
- ptr->data=(int)copy;
-
+ ENQUEUE(orig, *((void**)(&ptr->data)));
ptr=ptr->lnext;
}
}
struct RuntimeNode * ptr=fdtoobject->listhead;
while(ptr!=NULL) {
void *orig=(void *)ptr->data;
- void *copy;
- if (gc_createcopy(orig, ©))
- enqueue(orig);
- ptr->data=(int)copy;
-
+ ENQUEUE(orig, *((void**)(&ptr->data)));
ptr=ptr->lnext;
}
}
int i;
for(i=0;i<currtpd->numParameters;i++) {
void *orig=currtpd->parameterArray[i];
- void *copy;
- if (gc_createcopy(orig, ©))
- enqueue(orig);
- currtpd->parameterArray[i]=copy;
+ ENQUEUE(orig, currtpd->parameterArray[i]);
}
}
int i;
for(i=0;i<tpd->numParameters;i++) {
void * orig=tpd->parameterArray[i];
- void * copy;
- if (gc_createcopy(orig, ©))
- enqueue(orig);
- tpd->parameterArray[i]=copy;
+ ENQUEUE(orig, tpd->parameterArray[i]);
}
ptr=ptr->inext;
}
int i;
for(i=0;i<tpd->numParameters;i++) {
void * orig=tpd->parameterArray[i];
- void * copy;
- if (gc_createcopy(orig, ©))
- enqueue(orig);
- tpd->parameterArray[i]=copy;
+ ENQUEUE(orig, tpd->parameterArray[i]);
}
ptr=ptr->inext;
}
int i;
for(i=0;i<length;i++) {
void *objptr=((void **)(((char *)& ao->___length___)+sizeof(int)))[i];
- void * copy;
- if (gc_createcopy(objptr, ©))
- enqueue(objptr);
- ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=copy;
+ ENQUEUE(objptr, ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]);
}
} else {
int size=pointer[0];
for(i=1;i<=size;i++) {
unsigned int offset=pointer[i];
void * objptr=*((void **)(((int)ptr)+offset));
- void * copy;
- if (gc_createcopy(objptr, ©))
- enqueue(objptr);
- *((void **) (((int)cpy)+offset))=copy;
+ ENQUEUE(objptr, *((void **) (((int)cpy)+offset)));
}
}
}
}
#endif
-void * curr_heapbase=0;
-void * curr_heapptr=0;
-void * curr_heapgcpoint=0;
-void * curr_heaptop=0;
-
-void * to_heapbase=0;
-void * to_heapptr=0;
-void * to_heaptop=0;
-long lastgcsize=0;
-
void * tomalloc(int size) {
void * ptr=to_heapptr;
if ((size%4)!=0)