diff options
author | Brian Carlstrom <bdc@google.com> | 2014-09-05 13:01:41 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2014-09-05 13:24:24 -0700 |
commit | 306db81aba41eb244a4e8299cf58ac18ae9999c7 (patch) | |
tree | a069a9dda1b246466cbeee2736f46f18ef56714e /runtime/base/mutex.h | |
parent | b14339904c9cacc4af74260c7325e4eb32947f95 (diff) | |
download | art-306db81aba41eb244a4e8299cf58ac18ae9999c7.tar.gz art-306db81aba41eb244a4e8299cf58ac18ae9999c7.tar.bz2 art-306db81aba41eb244a4e8299cf58ac18ae9999c7.zip |
Fix numerous issues with DdmVmInternal allocation tracking
Issues addressed:
- Using without JDWP attached caused native crash.
- When buffer is full (64k entries), number of entries reported was 0.
- Disabling tracking after disabling tracking caused native crash.
- Asking for allocations after disabled caused native crash.
- Lock ordering issues between mutator lock and alloc tracker lock.
Adding 098-ddmc test to cover these cases.
Bug: 17392248
(cherry picked from commit a5815065ac0877add9c0db3605d27b4d6c426e61)
Change-Id: Ib0bc18dfcdafcc050ab9dceed3d167dd878d1d7a
Diffstat (limited to 'runtime/base/mutex.h')
-rw-r--r-- | runtime/base/mutex.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/runtime/base/mutex.h b/runtime/base/mutex.h index 2a623fdb05..6642b1e989 100644 --- a/runtime/base/mutex.h +++ b/runtime/base/mutex.h @@ -85,6 +85,7 @@ enum LockLevel { kJniLoadLibraryLock, kThreadListLock, kBreakpointInvokeLock, + kAllocTrackerLock, kDeoptimizationLock, kTraceLock, kProfilerLock, @@ -557,9 +558,17 @@ class Locks { // Guards trace (ie traceview) requests. static Mutex* trace_lock_ ACQUIRED_AFTER(profiler_lock_); + // Guards debugger recent allocation records. + static Mutex* alloc_tracker_lock_ ACQUIRED_AFTER(trace_lock_); + + // Guards updates to instrumentation to ensure mutual exclusion of + // events like deoptimization requests. + // TODO: improve name, perhaps instrumentation_update_lock_. + static Mutex* deoptimization_lock_ ACQUIRED_AFTER(alloc_tracker_lock_); + // The thread_list_lock_ guards ThreadList::list_. It is also commonly held to stop threads // attaching and detaching. - static Mutex* thread_list_lock_ ACQUIRED_AFTER(trace_lock_); + static Mutex* thread_list_lock_ ACQUIRED_AFTER(deoptimization_lock_); // Guards maintaining loading library data structures. static Mutex* jni_libraries_lock_ ACQUIRED_AFTER(thread_list_lock_); @@ -586,7 +595,7 @@ class Locks { static Mutex* intern_table_lock_ ACQUIRED_AFTER(modify_ldt_lock_); // Have an exclusive aborting thread. - static Mutex* abort_lock_ ACQUIRED_AFTER(classlinker_classes_lock_); + static Mutex* abort_lock_ ACQUIRED_AFTER(intern_table_lock_); // Allow mutual exclusion when manipulating Thread::suspend_count_. // TODO: Does the trade-off of a per-thread lock make sense? |