}
#if defined(THREADS)||defined(DSTM)||defined(STM)||defined(MLP)
/* Go to next thread */
+#ifndef MAC
+ //skip over us
+ if (listptr==&litem) {
+#ifdef MLP
+ // update forward list & memory queue for the current SESE
+ updateForwardList(&((SESEcommon*)listptr->seseCommon)->forwardList,FALSE);
+ updateMemoryQueue((SESEcommon*)(listptr->seseCommon));
#ifdef THREADS
{
struct lockvector * lvector=listptr->lvector;
int i;
for(i=0;i<lvector->index;i++) {
- struct ___Object___ *orig=lvector->locks[i].object
+ struct ___Object___ *orig=lvector->locks[i].object;
ENQUEUE(orig, lvector->locks[i].object);
}
}
#endif
-#ifndef MAC
- //skip over us
- if (listptr==&litem) {
-#ifdef MLP
- // update forward list & memory queue for the current SESE
- updateForwardList(&((SESEcommon*)listptr->seseCommon)->forwardList,FALSE);
- updateMemoryQueue((SESEcommon*)(listptr->seseCommon));
#endif
listptr=listptr->next;
}
if (listptr!=NULL) {
#ifdef THREADS
- void * orig=listptr->locklist;
- ENQUEUE(orig, listptr->locklist);
+ {
+ struct lockvector * lvector=listptr->lvector;
+ int i;
+ for(i=0;i<lvector->index;i++) {
+ struct ___Object___ *orig=lvector->locks[i].object;
+ ENQUEUE(orig, lvector->locks[i].object);
+ }
+ }
#endif
#ifdef STM
if ((*listptr->tc_table)!=NULL) {
struct ArrayObject *ao=(struct ArrayObject *) ptr;
struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy;
SENQUEUE((void *)ao->___objlocation___, *((void **)&ao_cpy->___objlocation___));
-#endif
-#ifdef THREADS
- {
- pointer=pointerarray[OBJECTTYPE];
- //handle object class
- INTPTR size=pointer[0];
- int i;
- for(i=1; i<=size; i++) {
- unsigned int offset=pointer[i];
- void * objptr=*((void **)(((char *)ptr)+offset));
- ENQUEUE(objptr, *((void **)(((char *)cpy)+offset)));
- }
- }
#endif
} else if (((INTPTR)pointer)==1) {
/* Array of pointers */
void *objptr=((void **)(((char *)&ao->___length___)+sizeof(int)))[i];
ENQUEUE(objptr, ((void **)(((char *)&ao_cpy->___length___)+sizeof(int)))[i]);
}
-#ifdef THREADS
- {
- pointer=pointerarray[OBJECTTYPE];
- //handle object class
- INTPTR size=pointer[0];
- int i;
- for(i=1; i<=size; i++) {
- unsigned int offset=pointer[i];
- void * objptr=*((void **)(((char *)ptr)+offset));
- ENQUEUE(objptr, *((void **)(((char *)cpy)+offset)));
- }
- }
-#endif
} else {
INTPTR size=pointer[0];
int i;
#endif
#ifndef MAC
litem.stackptr=ptr;
-#ifdef THREADS
- litem.locklist=pthread_getspecific(threadlocks);
-#endif
#if defined(STM)||defined(THREADS)||defined(MLP)
litem.base=&memorybase;
#endif
//handle MAC
struct listitem *litem=pthread_getspecific(litemkey);
litem->stackptr=ptr;
-#ifdef THREADS
- litem->locklist=pthread_getspecific(threadlocks);
-#endif
#endif
pthread_mutex_lock(&gclistlock);
listcount++;
#ifdef THREADS
#ifdef MAC
struct listitem *litem=pthread_getspecific(litemkey);
- pthread_setspecific(threadlocks,litem->locklist);
-#else
- pthread_setspecific(threadlocks,litem.locklist);
#endif
#endif
}
#endif
#ifndef MAC
-extern __thread struct lockvector lvector;
+__thread struct lockvector lvector;
#endif
#ifdef D___Object______nativehashCode____
#else
struct lockvector *lptr=&lvector;
#endif
- struct lockpair *lpair=lptr->locks[lptr->index];
+ struct lockpair *lpair=&lptr->locks[lptr->index];
pthread_t self=pthread_self();
lpair->object=VAR(___this___);
lptr->index++;
while(1) {
if (VAR(___this___)->lockcount==0) {
- if (CAS32(&VAR(___this___)->lockcount, 0, lockcount)==0) {
+ if (CAS32(&VAR(___this___)->lockcount, 0, 1)==0) {
VAR(___this___)->tid=self;
BARRIER();
return;
#else
struct lockvector *lptr=&lvector;
#endif
- struct lockpair *lpair=lptr->locks[--lptr->index];
+ struct lockpair *lpair=&lptr->locks[--lptr->index];
pthread_t self=pthread_self();
if (lpair->islastlock) {
#include "option.h"
#include <signal.h>
#include "methodheaders.h"
+#ifndef MULTICORE
+#include "mlp_lock.h"
+#endif
#ifdef DSTM
#ifdef RECOVERY
pthread_cond_init(&objcond,NULL);
pthread_mutex_init(&joinlock,NULL);
pthread_cond_init(&joincond,NULL);
- pthread_key_create(&threadlocks, NULL);
#ifdef MAC
+ pthread_key_create(&threadlocks, NULL);
pthread_key_create(&litem, NULL);
#endif
processOptions();
#endif
#ifdef MAC
struct listitem *litem=malloc(sizeof(struct listitem));
+ struct lockvector *lvector=malloc(sizeof(struct lockvector));
+ litem->lockvector=lvector;
+ lvector->index=0;
+ pthread_setspecific(threadlocks, lvector);
pthread_setspecific(litemkey, litem);
litem->prev=NULL;
litem->next=list;
//Add our litem to list of threads
litem.prev=NULL;
litem.next=list;
+ litem.lvector=&lvector;
+ lvector.index=0;
if(list!=NULL)
list->prev=&litem;
list=&litem;
pthread_setspecific(threadlocks, &lvector);
#endif
litem.lvector=&lvector;
+ lvector.index=0;
litem.prev=NULL;
pthread_mutex_lock(&gclistlock);
litem.next=list;