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>
Sat, 30 Jul 2016 00:54:09 +0000 (17:54 -0700)
commit4b0ef1c980a1f3b0201d77e33bdb2f7df12c9114
tree4b8891beab013872144d69f97e918f9914aaf8c8
parent7707777f064e9e0aa53c40c189045ab2ea4301ee
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.

Change-Id: Id8750df065dc3b9ef7dc874f2eb2cc2c58e5d1eb
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