remove lockcount
authorbdemsky <bdemsky>
Mon, 11 Apr 2011 21:17:37 +0000 (21:17 +0000)
committerbdemsky <bdemsky>
Mon, 11 Apr 2011 21:17:37 +0000 (21:17 +0000)
Robust/src/IR/Flat/BuildCode.java
Robust/src/Runtime/object.c
Robust/src/Runtime/runtime.c
Robust/src/Runtime/thread.c

index 3c73647dd44658dd08ecbaa1ef3f8b477986db55..965fbed29694c43f02421f8355e3aa343c69b2ed 100644 (file)
@@ -613,7 +613,6 @@ public class BuildCode {
     }
     if (state.THREAD) {
       outclassdefs.println("  pthread_t tid;");
-      outclassdefs.println("  volatile int lockcount;");
       outclassdefs.println("  volatile int notifycount;");
     }
     if(state.MGC) {
@@ -1551,7 +1550,6 @@ public class BuildCode {
     }
     if (state.THREAD) {
       classdefout.println("  pthread_t tid;");
-      classdefout.println("  volatile int lockcount;");
       classdefout.println("  volatile int notifycount;");
     }
     if (state.MGC) {
index 091b1218aedcc72071bd6d792041351a64f762f0..61159ecd898f6d42f6f8285e161e98219c23f29a 100644 (file)
@@ -56,9 +56,8 @@ void CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) {
   } else {
     lpair->islastlock=1;
     while(1) {
-      if (VAR(___this___)->lockcount==0) {
-       if (LOCKXCHG32(&VAR(___this___)->lockcount, 1)==0) {
-         VAR(___this___)->tid=self;
+      if (VAR(___this___)->tid==0) {
+       if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
          return;
        }
       }
@@ -93,7 +92,6 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
   BARRIER();
   VAR(___this___)->tid=0;
   BARRIER();
-  VAR(___this___)->lockcount=0;
   
   while(notifycount==VAR(___this___)->notifycount) {
 #ifdef PRECISE_GC
@@ -103,9 +101,8 @@ void CALL01(___Object______wait____, struct ___Object___ * ___this___) {
   }
 
   while(1) {
-    if (VAR(___this___)->lockcount==0) {
-      if (LOCKXCHG32(&VAR(___this___)->lockcount, 1)==0) {
-       VAR(___this___)->tid=self;
+    if (VAR(___this___)->tid==0) {
+      if (CAS32(&VAR(___this___)->tid, 0, self)==0) {
        BARRIER();
        return;
       }
@@ -128,9 +125,8 @@ void CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) {
   struct lockpair *lpair=&lptr->locks[--lptr->index];
   
   if (lpair->islastlock) {
-    lpair->object->tid=0;
     MBARRIER();
-    lpair->object->lockcount=0;
+    lpair->object->tid=0;
   }
 }
 #endif
index b3411862b06b1a1e48aaeb1379be0622c651cee3..403fa7975bb78df7582b93893af4a89389924396 100644 (file)
@@ -674,7 +674,6 @@ __attribute__((malloc)) void * allocate_newglobal(int type) {
   //printf("DEBUG %s(), type= %x\n", __func__, type);
 #ifdef THREADS
   v->tid=0;
-  v->lockcount=0;
 #endif
   return v;
 }
@@ -691,7 +690,6 @@ __attribute__((malloc)) struct ArrayObject * allocate_newarrayglobal(int type, i
   v->___length___=length;
 #ifdef THREADS
   v->tid=0;
-  v->lockcount=0;
 #endif
   return v;
 }
@@ -809,7 +807,6 @@ __attribute__((malloc)) void * allocate_new(void * ptr, int type) {
   v->type=type;
 #ifdef THREADS
   v->tid=0;
-  v->lockcount=0;
 #endif
 #ifdef OPTIONAL
   v->fses=0;
@@ -839,7 +836,6 @@ __attribute__((malloc)) struct ArrayObject * allocate_newarray(void * ptr, int t
   v->___length___=length;
 #ifdef THREADS
   v->tid=0;
-  v->lockcount=0;
 #endif
 #ifdef OPTIONAL
   v->fses=0;
index 30a97db6ee844344cab8ebe5b847362ead809aa6..c048e85e0f38a3f6f0dddfae22756f6ba407f15f 100644 (file)
@@ -76,8 +76,6 @@ void threadexit() {
     if (lptr->locks[lptr->index].islastlock) {
       struct ___Object___ *ll=lptr->locks[lptr->index].object;
       ll->tid=0;
-      BARRIER();
-      ll->lockcount=0;
     }
   }