OSDN Git Service

Revert "Revert "Use try lock to fix class resolution race""
authorMathieu Chartier <mathieuc@google.com>
Fri, 29 Jul 2016 23:26:01 +0000 (16:26 -0700)
committerMathieu Chartier <mathieuc@google.com>
Wed, 24 Aug 2016 01:10:10 +0000 (18:10 -0700)
commit23da026ec7a7fae22833ed2f61a80d9f9bf7e732
treeb19f9fa21f13c504b73b8df5d1097e66bd343668
parentadc538a57ad1f771051cd52afc216c3e5f0270cd
Revert "Revert "Use try lock to fix class resolution race""

Fix possible deadlock in EnsureResolved caused by interaction with
GC. Since we were sleeping while holding the mutator lock, it could
block thread suspension. This would deadlock if the thread that
had locked h_class is already suspended since we would spin forever
and not make progress.

Bug: 27417671
Bug: 30500547

Test: test-art-host ART_TEST_GC_STRESS=true

This reverts commit 69bf969c055c31a75d17ea92aeee756042678114.

(cherry picked from commit 4b0ef1c980a1f3b0201d77e33bdb2f7df12c9114)

Change-Id: If5766c2c3c8a130cbb83735cdb9970038570dafd
runtime/class_linker.cc
runtime/mirror/object-inl.h
runtime/mirror/object.h
runtime/monitor.cc
runtime/monitor.h
runtime/monitor_test.cc
runtime/object_lock.cc
runtime/object_lock.h