OSDN Git Service

Add exclusion between instrumentation and GC
authorMathieu Chartier <mathieuc@google.com>
Fri, 2 Oct 2015 22:53:37 +0000 (15:53 -0700)
committerMathieu Chartier <mathieuc@google.com>
Mon, 5 Oct 2015 18:50:18 +0000 (11:50 -0700)
commitaa5168291c46f9b418d989bccf2d8e09338a83e6
treebad4c44f503962fc5d74c3079f14f9af1ce7864d
parent1aba494df441c31836e5b7d4d8e408420a93cb8d
Add exclusion between instrumentation and GC

Instrumentation calls VisitClasses while exclusive holding the
mutator lock. This can cause deadlocks since VisitClasses needs to
decode JNI weak globals. If the system weak slow path flag is set,
then we wait holding locks while exclusive holding the mutator lock.
This causes a deadlock since the GC cannot acquire the mutator lock
to sweep system weaks.

This fixes a deadlock seen in one of the tracing tests.

Change-Id: I580152118e068a70f309dcc19df4144afec835dd
13 files changed:
runtime/Android.mk
runtime/debugger.cc
runtime/debugger.h
runtime/gc/collector_type.h
runtime/gc/gc_cause.cc
runtime/gc/gc_cause.h
runtime/gc/heap.cc
runtime/gc/heap.h
runtime/gc/scoped_gc_critical_section.cc [new file with mode: 0644]
runtime/gc/scoped_gc_critical_section.h [new file with mode: 0644]
runtime/instrumentation.h
runtime/instrumentation_test.cc
runtime/trace.cc