X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Robust%2Fsrc%2FRuntime%2Fobject.c;h=0bff6175391fbe6eb589233fe2b707f828f391b9;hb=4cb63e913202459da4fe9d01feb7c02f1b98dd6f;hp=8cf5ae62652a03e2cbb01a1a91edbd3d3298bd4c;hpb=608946d7742d6945ae1606ccf4a57749212fa140;p=IRC.git diff --git a/Robust/src/Runtime/object.c b/Robust/src/Runtime/object.c index 8cf5ae62..0bff6175 100644 --- a/Robust/src/Runtime/object.c +++ b/Robust/src/Runtime/object.c @@ -1,12 +1,16 @@ #include "object.h" +#ifdef RAW +#include +#else #include "stdio.h" +#endif #include "stdlib.h" #ifdef THREADS #include "thread.h" #endif -int CALL01(___Object______hashCode____, struct ___Object___ * ___this___) { +int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) { return (int) VAR(___this___); } @@ -20,18 +24,19 @@ int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) { if (self==VAR(___this___)->tid) { VAR(___this___)->lockcount++; } else { -#ifdef PRECISEGC - struct listitem *tmp=stopforgc(stackptr); +#ifdef PRECISE_GC + struct listitem *tmp=stopforgc((struct garbagelist *)___params___); #endif pthread_mutex_lock(&objlock); -#ifdef PRECISEGC +#ifdef PRECISE_GC restartaftergc(tmp); #endif while(1) { if (VAR(___this___)->tid==0) { VAR(___this___)->___prevlockobject___=NULL; VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks); - VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); + if (VAR(___this___)->___nextlockobject___!=NULL) + VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); pthread_setspecific(threadlocks, VAR(___this___)); VAR(___this___)->lockcount=1; VAR(___this___)->tid=self; @@ -39,11 +44,11 @@ int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) { break; } { -#ifdef PRECISEGC - struct listitem *tmp=stopforgc(stackptr); +#ifdef PRECISE_GC + struct listitem *tmp=stopforgc((struct garbagelist *)___params___); #endif pthread_cond_wait(&objcond, &objlock); -#ifdef PRECISEGC +#ifdef PRECISE_GC restartaftergc(tmp); #endif } @@ -69,8 +74,12 @@ int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) { pthread_cond_broadcast(&objcond); pthread_mutex_unlock(&objlock); } else { +#ifdef RAW + raw_test_done(-1); +#else printf("ERROR...UNLOCKING LOCK WE DON'T HAVE\n"); exit(-1); +#endif } } #endif