OSDN Git Service

Fix spin waiting for weak ref access in the intern table for CC.
authorHiroshi Yamauchi <yamauchi@google.com>
Thu, 3 Nov 2016 20:03:20 +0000 (13:03 -0700)
committerHiroshi Yamauchi <yamauchi@google.com>
Thu, 3 Nov 2016 20:03:20 +0000 (13:03 -0700)
Bug: 32637633
Test: test-art-host with CC
Change-Id: I8f0f9f5ca24687f688318ea5cafcbb7f6597448c

runtime/intern_table.cc

index 7b75109..d885226 100644 (file)
@@ -199,7 +199,8 @@ void InternTable::WaitUntilAccessible(Thread* self) {
   {
     ScopedThreadSuspension sts(self, kWaitingWeakGcRootRead);
     MutexLock mu(self, *Locks::intern_table_lock_);
-    while (weak_root_state_ == gc::kWeakRootStateNoReadsOrWrites) {
+    while ((!kUseReadBarrier && weak_root_state_ == gc::kWeakRootStateNoReadsOrWrites) ||
+           (kUseReadBarrier && !self->GetWeakRefAccessEnabled())) {
       weak_intern_condition_.Wait(self);
     }
   }