diff options
| -rw-r--r-- | runtime/jit/jit_code_cache.cc | 15 | ||||
| -rw-r--r-- | runtime/thread_list.cc | 3 | ||||
| -rwxr-xr-x | test/004-ThreadStress/run | 19 |
3 files changed, 12 insertions, 25 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index cfccec87cf..ce972ef976 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -25,6 +25,7 @@ #include "linear_alloc.h" #include "mem_map.h" #include "oat_file-inl.h" +#include "scoped_thread_state_change.h" #include "thread_list.h" namespace art { @@ -407,9 +408,17 @@ void JitCodeCache::GarbageCollectCache(Thread* self) { // Run a checkpoint on all threads to mark the JIT compiled code they are running. { Barrier barrier(0); - MarkCodeClosure closure(this, &barrier); - size_t threads_running_checkpoint = - Runtime::Current()->GetThreadList()->RunCheckpoint(&closure); + size_t threads_running_checkpoint = 0; + { + // Walking the stack requires the mutator lock. + // We only take the lock when running the checkpoint and not waiting so that + // when we go back to suspended, we can execute checkpoints that were requested + // concurrently, and then move to waiting for our own checkpoint to finish. + ScopedObjectAccess soa(self); + MarkCodeClosure closure(this, &barrier); + threads_running_checkpoint = + Runtime::Current()->GetThreadList()->RunCheckpoint(&closure); + } if (threads_running_checkpoint != 0) { barrier.Increment(self, threads_running_checkpoint); } diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index dcf9601b4b..b09b87fb58 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -275,9 +275,6 @@ size_t ThreadList::RunCheckpoint(Closure* checkpoint_function) { Locks::mutator_lock_->AssertNotExclusiveHeld(self); Locks::thread_list_lock_->AssertNotHeld(self); Locks::thread_suspend_count_lock_->AssertNotHeld(self); - if (kDebugLocking && gAborting == 0) { - CHECK_NE(self->GetState(), kRunnable); - } std::vector<Thread*> suspended_count_modified_threads; size_t count = 0; diff --git a/test/004-ThreadStress/run b/test/004-ThreadStress/run deleted file mode 100755 index 27c501da8d..0000000000 --- a/test/004-ThreadStress/run +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2015 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Be less agressive than the default debug option for the jit code cache -# to avoid timeouts. -exec ${RUN} "$@" --runtime-option -Xjitcodecachesize:1M |