diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-03-06 11:11:48 -0800 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-03-06 11:43:06 -0800 |
commit | 6dda898d47b3e8931e4404330e81b7110108e34f (patch) | |
tree | d8a0a20b8ac1ce3cd44273cf5c748d09980bd800 /runtime/thread_list.cc | |
parent | 8785d615122d4abbd22db702139584e8c472f502 (diff) | |
download | art-6dda898d47b3e8931e4404330e81b7110108e34f.zip art-6dda898d47b3e8931e4404330e81b7110108e34f.tar.gz art-6dda898d47b3e8931e4404330e81b7110108e34f.tar.bz2 |
Disable compaction for jni workarounds.
Compaction can't work when jni workarounds is enabled. Also some
other refactoring.
Change-Id: Ia7b0f2b39c79f5a0a5f50874d823b950ab02a0c3
Diffstat (limited to 'runtime/thread_list.cc')
-rw-r--r-- | runtime/thread_list.cc | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index d311945..7745a19 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc @@ -193,10 +193,10 @@ static void ThreadSuspendSleep(Thread* self, useconds_t* delay_us, useconds_t* t size_t ThreadList::RunCheckpoint(Closure* checkpoint_function) { Thread* self = Thread::Current(); - if (kIsDebugBuild) { - Locks::mutator_lock_->AssertNotExclusiveHeld(self); - Locks::thread_list_lock_->AssertNotHeld(self); - Locks::thread_suspend_count_lock_->AssertNotHeld(self); + Locks::mutator_lock_->AssertNotExclusiveHeld(self); + Locks::thread_list_lock_->AssertNotHeld(self); + Locks::thread_suspend_count_lock_->AssertNotHeld(self); + if (kDebugLocking) { CHECK_NE(self->GetState(), kRunnable); } @@ -273,26 +273,24 @@ void ThreadList::SuspendAll() { VLOG(threads) << *self << " SuspendAll starting..."; - if (kIsDebugBuild) { - Locks::mutator_lock_->AssertNotHeld(self); - Locks::thread_list_lock_->AssertNotHeld(self); - Locks::thread_suspend_count_lock_->AssertNotHeld(self); + Locks::mutator_lock_->AssertNotHeld(self); + Locks::thread_list_lock_->AssertNotHeld(self); + Locks::thread_suspend_count_lock_->AssertNotHeld(self); + if (kDebugLocking) { CHECK_NE(self->GetState(), kRunnable); } { MutexLock mu(self, *Locks::thread_list_lock_); - { - MutexLock mu2(self, *Locks::thread_suspend_count_lock_); - // Update global suspend all state for attaching threads. - ++suspend_all_count_; - // Increment everybody's suspend count (except our own). - for (const auto& thread : list_) { - if (thread == self) { - continue; - } - VLOG(threads) << "requesting thread suspend: " << *thread; - thread->ModifySuspendCount(self, +1, false); + MutexLock mu2(self, *Locks::thread_suspend_count_lock_); + // Update global suspend all state for attaching threads. + ++suspend_all_count_; + // Increment everybody's suspend count (except our own). + for (const auto& thread : list_) { + if (thread == self) { + continue; } + VLOG(threads) << "requesting thread suspend: " << *thread; + thread->ModifySuspendCount(self, +1, false); } } @@ -306,8 +304,10 @@ void ThreadList::SuspendAll() { Locks::mutator_lock_->ExclusiveLock(self); #endif - // Debug check that all threads are suspended. - AssertThreadsAreSuspended(self, self); + if (kDebugLocking) { + // Debug check that all threads are suspended. + AssertThreadsAreSuspended(self, self); + } VLOG(threads) << *self << " SuspendAll complete"; } @@ -317,8 +317,10 @@ void ThreadList::ResumeAll() { VLOG(threads) << *self << " ResumeAll starting"; - // Debug check that all threads are suspended. - AssertThreadsAreSuspended(self, self); + if (kDebugLocking) { + // Debug check that all threads are suspended. + AssertThreadsAreSuspended(self, self); + } Locks::mutator_lock_->ExclusiveUnlock(self); { |