OSDN Git Service

Clean-up the use of barriers in the synchronization code.
authorCarl Shapiro <cshapiro@google.com>
Mon, 21 Jun 2010 18:04:33 +0000 (11:04 -0700)
committerCarl Shapiro <cshapiro@google.com>
Mon, 21 Jun 2010 18:04:33 +0000 (11:04 -0700)
* Use a releasing store to update the lockword when inflating.

* Remove the barrier following the interrupted flag update.  The
  mutex release that follows should have the same effect.

Change-Id: I9c8b31769e5767a9748d01278cf01be9678de2a5

vm/Sync.c

index 5380f3e..76baa31 100644 (file)
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -894,8 +894,7 @@ static void inflateMonitor(Thread *self, Object *obj)
     thin &= LW_HASH_STATE_MASK << LW_HASH_STATE_SHIFT;
     thin |= (u4)mon | LW_SHAPE_FAT;
     /* Publish the updated lock word. */
-    ANDROID_MEMBAR_FULL();
-    obj->lock = thin;
+    android_atomic_release_store(thin, (int32_t *)&obj->lock);
 }
 
 /*
@@ -1292,7 +1291,6 @@ void dvmThreadInterrupt(Thread* thread)
      * something.
      */
     thread->interrupted = true;
-    ANDROID_MEMBAR_FULL();
 
     /*
      * Is the thread waiting?