diff options
| author | 2018-05-26 01:34:59 +0000 | |
|---|---|---|
| committer | 2018-05-26 01:34:59 +0000 | |
| commit | 2c2e723f1b8aaec35fdf0c4f603e23d8ebd54cbb (patch) | |
| tree | 923fdd2a87db540aae56651ee08f9ef4e675fd57 /openjdkjvmti/ti_stack.cc | |
| parent | eb0526c20ac87ad12dc87d53a15113ccc2bb1ea7 (diff) | |
| parent | 6baa1c928ba2bd9127b370729d96ff4bcaafcea4 (diff) | |
Merge "ART: Ensure correct thread state for stack trace collection"
Diffstat (limited to 'openjdkjvmti/ti_stack.cc')
| -rw-r--r-- | openjdkjvmti/ti_stack.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/openjdkjvmti/ti_stack.cc b/openjdkjvmti/ti_stack.cc index eee8108b01..318d98d877 100644 --- a/openjdkjvmti/ti_stack.cc +++ b/openjdkjvmti/ti_stack.cc @@ -322,7 +322,9 @@ struct GetAllStackTracesVectorClosure : public art::Closure { }; template <typename Data> -static void RunCheckpointAndWait(Data* data, size_t max_frame_count) { +static void RunCheckpointAndWait(Data* data, size_t max_frame_count) + REQUIRES_SHARED(art::Locks::mutator_lock_) { + // Note: requires the mutator lock as the checkpoint requires the mutator lock. GetAllStackTracesVectorClosure<Data> closure(max_frame_count, data); size_t barrier_count = art::Runtime::Current()->GetThreadList()->RunCheckpoint(&closure, nullptr); if (barrier_count == 0) { @@ -380,9 +382,11 @@ jvmtiError StackUtil::GetAllStackTraces(jvmtiEnv* env, }; AllStackTracesData data; - RunCheckpointAndWait(&data, static_cast<size_t>(max_frame_count)); - art::Thread* current = art::Thread::Current(); + { + art::ScopedObjectAccess soa(current); + RunCheckpointAndWait(&data, static_cast<size_t>(max_frame_count)); + } // Convert the data into our output format. |