Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_THREAD_INL_H_ |
| 18 | #define ART_RUNTIME_THREAD_INL_H_ |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 19 | |
| 20 | #include "thread.h" |
| 21 | |
Andreas Gampe | 639b2b1 | 2019-01-08 10:32:50 -0800 | [diff] [blame] | 22 | #include "arch/instruction_set.h" |
Andreas Gampe | 39b378c | 2017-12-07 15:44:13 -0800 | [diff] [blame] | 23 | #include "base/aborting.h" |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 24 | #include "base/casts.h" |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 25 | #include "base/mutex-inl.h" |
Andreas Gampe | d490129 | 2017-05-30 18:41:34 -0700 | [diff] [blame] | 26 | #include "base/time_utils.h" |
Vladimir Marko | a3ad0cd | 2018-05-04 10:06:38 +0100 | [diff] [blame] | 27 | #include "jni/jni_env_ext.h" |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 28 | #include "managed_stack-inl.h" |
Andreas Gampe | c73cb64 | 2017-02-22 10:11:30 -0800 | [diff] [blame] | 29 | #include "obj_ptr.h" |
Andreas Gampe | 0c2313c | 2019-05-14 09:47:00 -0700 | [diff] [blame] | 30 | #include "suspend_reason.h" |
Andreas Gampe | b486a98 | 2017-06-01 13:45:54 -0700 | [diff] [blame] | 31 | #include "thread-current-inl.h" |
Mathieu Chartier | 3cf2253 | 2015-07-09 15:15:09 -0700 | [diff] [blame] | 32 | #include "thread_pool.h" |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 33 | |
| 34 | namespace art { |
| 35 | |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 36 | // Quickly access the current thread from a JNIEnv. |
| 37 | static inline Thread* ThreadForEnv(JNIEnv* env) { |
| 38 | JNIEnvExt* full_env(down_cast<JNIEnvExt*>(env)); |
Ian Rogers | 55256cb | 2017-12-21 17:07:11 -0800 | [diff] [blame] | 39 | return full_env->GetSelf(); |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame] | 40 | } |
| 41 | |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 42 | inline void Thread::AllowThreadSuspension() { |
Vladimir Marko | 254a858 | 2021-11-29 14:08:37 +0000 | [diff] [blame] | 43 | CheckSuspend(); |
Mathieu Chartier | a59d9b2 | 2016-09-26 18:13:17 -0700 | [diff] [blame] | 44 | // Invalidate the current thread's object pointers (ObjPtr) to catch possible moving GC bugs due |
| 45 | // to missing handles. |
Mathieu Chartier | 3f7f03c | 2016-09-26 11:39:52 -0700 | [diff] [blame] | 46 | PoisonObjectPointers(); |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 47 | } |
| 48 | |
Vladimir Marko | e45883e | 2022-01-11 12:38:35 +0000 | [diff] [blame] | 49 | inline void Thread::CheckSuspend(bool implicit) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 50 | DCHECK_EQ(Thread::Current(), this); |
Vladimir Marko | 254a858 | 2021-11-29 14:08:37 +0000 | [diff] [blame] | 51 | while (true) { |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 52 | StateAndFlags state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | 254a858 | 2021-11-29 14:08:37 +0000 | [diff] [blame] | 53 | if (LIKELY(!state_and_flags.IsAnyOfFlagsSet(SuspendOrCheckpointRequestFlags()))) { |
| 54 | break; |
| 55 | } else if (state_and_flags.IsFlagSet(ThreadFlag::kCheckpointRequest)) { |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 56 | RunCheckpointFunction(); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 57 | } else if (state_and_flags.IsFlagSet(ThreadFlag::kSuspendRequest)) { |
Vladimir Marko | e45883e | 2022-01-11 12:38:35 +0000 | [diff] [blame] | 58 | FullSuspendCheck(implicit); |
| 59 | implicit = false; // We do not need to `MadviseAwayAlternateSignalStack()` anymore. |
Hiroshi Yamauchi | 3049324 | 2016-11-03 13:06:52 -0700 | [diff] [blame] | 60 | } else { |
Vladimir Marko | 254a858 | 2021-11-29 14:08:37 +0000 | [diff] [blame] | 61 | DCHECK(state_and_flags.IsFlagSet(ThreadFlag::kEmptyCheckpointRequest)); |
| 62 | RunEmptyCheckpoint(); |
Hiroshi Yamauchi | 3049324 | 2016-11-03 13:06:52 -0700 | [diff] [blame] | 63 | } |
| 64 | } |
Vladimir Marko | e45883e | 2022-01-11 12:38:35 +0000 | [diff] [blame] | 65 | if (implicit) { |
| 66 | // For implicit suspend check we want to `madvise()` away |
| 67 | // the alternate signal stack to avoid wasting memory. |
| 68 | MadviseAwayAlternateSignalStack(); |
| 69 | } |
Hiroshi Yamauchi | 3049324 | 2016-11-03 13:06:52 -0700 | [diff] [blame] | 70 | } |
| 71 | |
Hiroshi Yamauchi | a222404 | 2017-02-08 16:35:45 -0800 | [diff] [blame] | 72 | inline void Thread::CheckEmptyCheckpointFromWeakRefAccess(BaseMutex* cond_var_mutex) { |
| 73 | Thread* self = Thread::Current(); |
| 74 | DCHECK_EQ(self, this); |
| 75 | for (;;) { |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 76 | if (ReadFlag(ThreadFlag::kEmptyCheckpointRequest)) { |
Hiroshi Yamauchi | a222404 | 2017-02-08 16:35:45 -0800 | [diff] [blame] | 77 | RunEmptyCheckpoint(); |
| 78 | // Check we hold only an expected mutex when accessing weak ref. |
| 79 | if (kIsDebugBuild) { |
| 80 | for (int i = kLockLevelCount - 1; i >= 0; --i) { |
| 81 | BaseMutex* held_mutex = self->GetHeldMutex(static_cast<LockLevel>(i)); |
| 82 | if (held_mutex != nullptr && |
Vladimir Marko | 23cf32f | 2021-11-15 13:38:02 +0000 | [diff] [blame] | 83 | held_mutex != GetMutatorLock() && |
Hiroshi Yamauchi | a222404 | 2017-02-08 16:35:45 -0800 | [diff] [blame] | 84 | held_mutex != cond_var_mutex) { |
Hiroshi Yamauchi | 8a43324 | 2017-03-07 14:39:22 -0800 | [diff] [blame] | 85 | CHECK(Locks::IsExpectedOnWeakRefAccess(held_mutex)) |
Hiroshi Yamauchi | a222404 | 2017-02-08 16:35:45 -0800 | [diff] [blame] | 86 | << "Holding unexpected mutex " << held_mutex->GetName() |
| 87 | << " when accessing weak ref"; |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | } else { |
| 92 | break; |
| 93 | } |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | inline void Thread::CheckEmptyCheckpointFromMutex() { |
Hiroshi Yamauchi | 3049324 | 2016-11-03 13:06:52 -0700 | [diff] [blame] | 98 | DCHECK_EQ(Thread::Current(), this); |
| 99 | for (;;) { |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 100 | if (ReadFlag(ThreadFlag::kEmptyCheckpointRequest)) { |
Hiroshi Yamauchi | 3049324 | 2016-11-03 13:06:52 -0700 | [diff] [blame] | 101 | RunEmptyCheckpoint(); |
Ian Rogers | 7b078e8 | 2014-09-10 14:44:24 -0700 | [diff] [blame] | 102 | } else { |
| 103 | break; |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame] | 108 | inline ThreadState Thread::SetState(ThreadState new_state) { |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 109 | // Should only be used to change between suspended states. |
| 110 | // Cannot use this code to change into or from Runnable as changing to Runnable should |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 111 | // fail if the `ThreadFlag::kSuspendRequest` is set and changing from Runnable might |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 112 | // miss passing an active suspend barrier. |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 113 | DCHECK_NE(new_state, ThreadState::kRunnable); |
Andreas Gampe | ef048f6 | 2014-11-25 22:12:27 -0800 | [diff] [blame] | 114 | if (kIsDebugBuild && this != Thread::Current()) { |
| 115 | std::string name; |
| 116 | GetThreadName(name); |
| 117 | LOG(FATAL) << "Thread \"" << name << "\"(" << this << " != Thread::Current()=" |
| 118 | << Thread::Current() << ") changing state to " << new_state; |
| 119 | } |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 120 | |
| 121 | while (true) { |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 122 | StateAndFlags old_state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 123 | CHECK_NE(old_state_and_flags.GetState(), ThreadState::kRunnable) |
| 124 | << new_state << " " << *this << " " << *Thread::Current(); |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 125 | StateAndFlags new_state_and_flags = old_state_and_flags.WithState(new_state); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 126 | bool done = |
| 127 | tls32_.state_and_flags.CompareAndSetWeakRelaxed(old_state_and_flags.GetValue(), |
| 128 | new_state_and_flags.GetValue()); |
| 129 | if (done) { |
| 130 | return static_cast<ThreadState>(old_state_and_flags.GetState()); |
| 131 | } |
| 132 | } |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame] | 133 | } |
| 134 | |
Mathieu Chartier | 10b218d | 2016-07-25 17:48:52 -0700 | [diff] [blame] | 135 | inline bool Thread::IsThreadSuspensionAllowable() const { |
| 136 | if (tls32_.no_thread_suspension != 0) { |
| 137 | return false; |
| 138 | } |
| 139 | for (int i = kLockLevelCount - 1; i >= 0; --i) { |
Alex Light | 88fd720 | 2017-06-30 08:31:59 -0700 | [diff] [blame] | 140 | if (i != kMutatorLock && |
| 141 | i != kUserCodeSuspensionLock && |
| 142 | GetHeldMutex(static_cast<LockLevel>(i)) != nullptr) { |
Mathieu Chartier | 10b218d | 2016-07-25 17:48:52 -0700 | [diff] [blame] | 143 | return false; |
| 144 | } |
| 145 | } |
Alex Light | 88fd720 | 2017-06-30 08:31:59 -0700 | [diff] [blame] | 146 | // Thread autoanalysis isn't able to understand that the GetHeldMutex(...) or AssertHeld means we |
| 147 | // have the mutex meaning we need to do this hack. |
| 148 | auto is_suspending_for_user_code = [this]() NO_THREAD_SAFETY_ANALYSIS { |
| 149 | return tls32_.user_code_suspend_count != 0; |
| 150 | }; |
| 151 | if (GetHeldMutex(kUserCodeSuspensionLock) != nullptr && is_suspending_for_user_code()) { |
| 152 | return false; |
| 153 | } |
Mathieu Chartier | 10b218d | 2016-07-25 17:48:52 -0700 | [diff] [blame] | 154 | return true; |
| 155 | } |
| 156 | |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 157 | inline void Thread::AssertThreadSuspensionIsAllowable(bool check_locks) const { |
Ian Rogers | f3d874c | 2014-07-17 18:52:42 -0700 | [diff] [blame] | 158 | if (kIsDebugBuild) { |
Nicolas Geoffray | db97871 | 2014-12-09 13:33:38 +0000 | [diff] [blame] | 159 | if (gAborting == 0) { |
| 160 | CHECK_EQ(0u, tls32_.no_thread_suspension) << tlsPtr_.last_no_thread_suspension_cause; |
| 161 | } |
Ian Rogers | f3d874c | 2014-07-17 18:52:42 -0700 | [diff] [blame] | 162 | if (check_locks) { |
| 163 | bool bad_mutexes_held = false; |
| 164 | for (int i = kLockLevelCount - 1; i >= 0; --i) { |
Vladimir Marko | 23cf32f | 2021-11-15 13:38:02 +0000 | [diff] [blame] | 165 | // We expect no locks except the mutator lock. User code suspension lock is OK as long as |
Alex Light | 88fd720 | 2017-06-30 08:31:59 -0700 | [diff] [blame] | 166 | // we aren't going to be held suspended due to SuspendReason::kForUserCode. |
| 167 | if (i != kMutatorLock && i != kUserCodeSuspensionLock) { |
Ian Rogers | f3d874c | 2014-07-17 18:52:42 -0700 | [diff] [blame] | 168 | BaseMutex* held_mutex = GetHeldMutex(static_cast<LockLevel>(i)); |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 169 | if (held_mutex != nullptr) { |
Ian Rogers | f3d874c | 2014-07-17 18:52:42 -0700 | [diff] [blame] | 170 | LOG(ERROR) << "holding \"" << held_mutex->GetName() |
| 171 | << "\" at point where thread suspension is expected"; |
| 172 | bad_mutexes_held = true; |
| 173 | } |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 174 | } |
| 175 | } |
Alex Light | 88fd720 | 2017-06-30 08:31:59 -0700 | [diff] [blame] | 176 | // Make sure that if we hold the user_code_suspension_lock_ we aren't suspending due to |
| 177 | // user_code_suspend_count which would prevent the thread from ever waking up. Thread |
| 178 | // autoanalysis isn't able to understand that the GetHeldMutex(...) or AssertHeld means we |
| 179 | // have the mutex meaning we need to do this hack. |
| 180 | auto is_suspending_for_user_code = [this]() NO_THREAD_SAFETY_ANALYSIS { |
| 181 | return tls32_.user_code_suspend_count != 0; |
| 182 | }; |
| 183 | if (GetHeldMutex(kUserCodeSuspensionLock) != nullptr && is_suspending_for_user_code()) { |
| 184 | LOG(ERROR) << "suspending due to user-code while holding \"" |
| 185 | << Locks::user_code_suspension_lock_->GetName() << "\"! Thread would never " |
| 186 | << "wake up."; |
| 187 | bad_mutexes_held = true; |
| 188 | } |
Nicolas Geoffray | db97871 | 2014-12-09 13:33:38 +0000 | [diff] [blame] | 189 | if (gAborting == 0) { |
| 190 | CHECK(!bad_mutexes_held); |
| 191 | } |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 192 | } |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 193 | } |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 194 | } |
| 195 | |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 196 | inline void Thread::TransitionToSuspendedAndRunCheckpoints(ThreadState new_state) { |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 197 | DCHECK_NE(new_state, ThreadState::kRunnable); |
Dave Allison | 0f5f6bb | 2013-11-22 17:39:19 -0800 | [diff] [blame] | 198 | while (true) { |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 199 | StateAndFlags old_state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 200 | DCHECK_EQ(old_state_and_flags.GetState(), ThreadState::kRunnable); |
| 201 | if (UNLIKELY(old_state_and_flags.IsFlagSet(ThreadFlag::kCheckpointRequest))) { |
Ian Rogers | d9c4fc9 | 2013-10-01 19:45:43 -0700 | [diff] [blame] | 202 | RunCheckpointFunction(); |
| 203 | continue; |
| 204 | } |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 205 | if (UNLIKELY(old_state_and_flags.IsFlagSet(ThreadFlag::kEmptyCheckpointRequest))) { |
Hiroshi Yamauchi | 3049324 | 2016-11-03 13:06:52 -0700 | [diff] [blame] | 206 | RunEmptyCheckpoint(); |
| 207 | continue; |
| 208 | } |
Dave Allison | 0f5f6bb | 2013-11-22 17:39:19 -0800 | [diff] [blame] | 209 | // Change the state but keep the current flags (kCheckpointRequest is clear). |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 210 | DCHECK(!old_state_and_flags.IsFlagSet(ThreadFlag::kCheckpointRequest)); |
| 211 | DCHECK(!old_state_and_flags.IsFlagSet(ThreadFlag::kEmptyCheckpointRequest)); |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 212 | StateAndFlags new_state_and_flags = old_state_and_flags.WithState(new_state); |
Ian Rogers | b8e087e | 2014-07-09 21:12:06 -0700 | [diff] [blame] | 213 | |
Hans Boehm | 891cb88 | 2020-07-31 12:06:58 -0700 | [diff] [blame] | 214 | // CAS the value, ensuring that prior memory operations are visible to any thread |
| 215 | // that observes that we are suspended. |
Ian Rogers | b8e087e | 2014-07-09 21:12:06 -0700 | [diff] [blame] | 216 | bool done = |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 217 | tls32_.state_and_flags.CompareAndSetWeakRelease(old_state_and_flags.GetValue(), |
| 218 | new_state_and_flags.GetValue()); |
Ian Rogers | b8e087e | 2014-07-09 21:12:06 -0700 | [diff] [blame] | 219 | if (LIKELY(done)) { |
Dave Allison | 0f5f6bb | 2013-11-22 17:39:19 -0800 | [diff] [blame] | 220 | break; |
| 221 | } |
| 222 | } |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 223 | } |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 224 | |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 225 | inline void Thread::PassActiveSuspendBarriers() { |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 226 | while (true) { |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 227 | StateAndFlags state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 228 | if (LIKELY(!state_and_flags.IsFlagSet(ThreadFlag::kCheckpointRequest) && |
| 229 | !state_and_flags.IsFlagSet(ThreadFlag::kEmptyCheckpointRequest) && |
| 230 | !state_and_flags.IsFlagSet(ThreadFlag::kActiveSuspendBarrier))) { |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 231 | break; |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 232 | } else if (state_and_flags.IsFlagSet(ThreadFlag::kActiveSuspendBarrier)) { |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 233 | PassActiveSuspendBarriers(this); |
| 234 | } else { |
| 235 | // Impossible |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 236 | LOG(FATAL) << "Fatal, thread transitioned into suspended without running the checkpoint"; |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 237 | } |
| 238 | } |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 239 | } |
| 240 | |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 241 | inline void Thread::TransitionFromRunnableToSuspended(ThreadState new_state) { |
Vladimir Marko | ce2a344 | 2021-11-24 15:10:26 +0000 | [diff] [blame] | 242 | // Note: JNI stubs inline a fast path of this method that transitions to suspended if |
| 243 | // there are no flags set and then clears the `held_mutexes[kMutatorLock]` (this comes |
| 244 | // from a specialized `BaseMutex::RegisterAsLockedImpl(., kMutatorLock)` inlined from |
| 245 | // the `GetMutatorLock()->TransitionFromRunnableToSuspended(this)` below). |
| 246 | // Therefore any code added here (other than debug build assertions) should be gated |
| 247 | // on some flag being set, so that the JNI stub can take the slow path to get here. |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 248 | AssertThreadSuspensionIsAllowable(); |
Mathieu Chartier | 3398c78 | 2016-09-30 10:27:43 -0700 | [diff] [blame] | 249 | PoisonObjectPointersIfDebug(); |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 250 | DCHECK_EQ(this, Thread::Current()); |
| 251 | // Change to non-runnable state, thereby appearing suspended to the system. |
| 252 | TransitionToSuspendedAndRunCheckpoints(new_state); |
Vladimir Marko | 23cf32f | 2021-11-15 13:38:02 +0000 | [diff] [blame] | 253 | // Mark the release of the share of the mutator lock. |
| 254 | GetMutatorLock()->TransitionFromRunnableToSuspended(this); |
Mathieu Chartier | 8ac9c91 | 2015-10-01 15:58:41 -0700 | [diff] [blame] | 255 | // Once suspended - check the active suspend barrier flag |
| 256 | PassActiveSuspendBarriers(); |
| 257 | } |
| 258 | |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 259 | inline ThreadState Thread::TransitionFromSuspendedToRunnable() { |
Vladimir Marko | e74e0ce | 2021-12-08 14:16:21 +0000 | [diff] [blame] | 260 | // Note: JNI stubs inline a fast path of this method that transitions to Runnable if |
| 261 | // there are no flags set and then stores the mutator lock to `held_mutexes[kMutatorLock]` |
| 262 | // (this comes from a specialized `BaseMutex::RegisterAsUnlockedImpl(., kMutatorLock)` |
| 263 | // inlined from the `GetMutatorLock()->TransitionFromSuspendedToRunnable(this)` below). |
| 264 | // Therefore any code added here (other than debug build assertions) should be gated |
| 265 | // on some flag being set, so that the JNI stub can take the slow path to get here. |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 266 | StateAndFlags old_state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 267 | ThreadState old_state = old_state_and_flags.GetState(); |
| 268 | DCHECK_NE(old_state, ThreadState::kRunnable); |
| 269 | while (true) { |
Vladimir Marko | 23cf32f | 2021-11-15 13:38:02 +0000 | [diff] [blame] | 270 | GetMutatorLock()->AssertNotHeld(this); // Otherwise we starve GC. |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 271 | // Optimize for the return from native code case - this is the fast path. |
| 272 | // Atomically change from suspended to runnable if no suspend request pending. |
Vladimir Marko | 254a858 | 2021-11-29 14:08:37 +0000 | [diff] [blame] | 273 | constexpr uint32_t kCheckedFlags = |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 274 | SuspendOrCheckpointRequestFlags() | |
| 275 | enum_cast<uint32_t>(ThreadFlag::kActiveSuspendBarrier) | |
| 276 | FlipFunctionFlags(); |
Vladimir Marko | 254a858 | 2021-11-29 14:08:37 +0000 | [diff] [blame] | 277 | if (LIKELY(!old_state_and_flags.IsAnyOfFlagsSet(kCheckedFlags))) { |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 278 | // CAS the value with a memory barrier. |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 279 | StateAndFlags new_state_and_flags = old_state_and_flags.WithState(ThreadState::kRunnable); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 280 | if (LIKELY(tls32_.state_and_flags.CompareAndSetWeakAcquire(old_state_and_flags.GetValue(), |
| 281 | new_state_and_flags.GetValue()))) { |
Vladimir Marko | 23cf32f | 2021-11-15 13:38:02 +0000 | [diff] [blame] | 282 | // Mark the acquisition of a share of the mutator lock. |
| 283 | GetMutatorLock()->TransitionFromSuspendedToRunnable(this); |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 284 | break; |
| 285 | } |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 286 | } else if (old_state_and_flags.IsFlagSet(ThreadFlag::kActiveSuspendBarrier)) { |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 287 | PassActiveSuspendBarriers(this); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 288 | } else if (UNLIKELY(old_state_and_flags.IsFlagSet(ThreadFlag::kCheckpointRequest) || |
| 289 | old_state_and_flags.IsFlagSet(ThreadFlag::kEmptyCheckpointRequest))) { |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 290 | // Checkpoint flags should not be set while in suspended state. |
Vladimir Marko | 254a858 | 2021-11-29 14:08:37 +0000 | [diff] [blame] | 291 | static_assert(static_cast<std::underlying_type_t<ThreadState>>(ThreadState::kRunnable) == 0u); |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 292 | LOG(FATAL) << "Transitioning to Runnable with checkpoint flag," |
| 293 | // Note: Keeping unused flags. If they are set, it points to memory corruption. |
| 294 | << " flags=" << old_state_and_flags.WithState(ThreadState::kRunnable).GetValue() |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 295 | << " state=" << old_state_and_flags.GetState(); |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 296 | } else if (old_state_and_flags.IsFlagSet(ThreadFlag::kSuspendRequest)) { |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 297 | // Wait while our suspend count is non-zero. |
Nicolas Geoffray | 9f5f8ac | 2016-06-29 14:39:59 +0100 | [diff] [blame] | 298 | |
| 299 | // We pass null to the MutexLock as we may be in a situation where the |
| 300 | // runtime is shutting down. Guarding ourselves from that situation |
| 301 | // requires to take the shutdown lock, which is undesirable here. |
| 302 | Thread* thread_to_pass = nullptr; |
| 303 | if (kIsDebugBuild && !IsDaemon()) { |
| 304 | // We know we can make our debug locking checks on non-daemon threads, |
| 305 | // so re-enable them on debug builds. |
| 306 | thread_to_pass = this; |
| 307 | } |
| 308 | MutexLock mu(thread_to_pass, *Locks::thread_suspend_count_lock_); |
Hiroshi Yamauchi | ee23582 | 2016-08-19 17:03:27 -0700 | [diff] [blame] | 309 | ScopedTransitioningToRunnable scoped_transitioning_to_runnable(this); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 310 | // Reload state and flags after locking the mutex. |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 311 | old_state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 312 | DCHECK_EQ(old_state, old_state_and_flags.GetState()); |
| 313 | while (old_state_and_flags.IsFlagSet(ThreadFlag::kSuspendRequest)) { |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 314 | // Re-check when Thread::resume_cond_ is notified. |
Nicolas Geoffray | 9f5f8ac | 2016-06-29 14:39:59 +0100 | [diff] [blame] | 315 | Thread::resume_cond_->Wait(thread_to_pass); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 316 | // Reload state and flags after waiting. |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 317 | old_state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 318 | DCHECK_EQ(old_state, old_state_and_flags.GetState()); |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 319 | } |
| 320 | DCHECK_EQ(GetSuspendCount(), 0); |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 321 | } else if (UNLIKELY(old_state_and_flags.IsFlagSet(ThreadFlag::kRunningFlipFunction)) || |
| 322 | UNLIKELY(old_state_and_flags.IsFlagSet(ThreadFlag::kWaitingForFlipFunction))) { |
| 323 | // The thread should be suspended while another thread is running the flip function. |
| 324 | static_assert(static_cast<std::underlying_type_t<ThreadState>>(ThreadState::kRunnable) == 0u); |
| 325 | LOG(FATAL) << "Transitioning to Runnable while another thread is running the flip function," |
| 326 | // Note: Keeping unused flags. If they are set, it points to memory corruption. |
| 327 | << " flags=" << old_state_and_flags.WithState(ThreadState::kRunnable).GetValue() |
| 328 | << " state=" << old_state_and_flags.GetState(); |
| 329 | } else { |
| 330 | DCHECK(old_state_and_flags.IsFlagSet(ThreadFlag::kPendingFlipFunction)); |
| 331 | // CAS the value with a memory barrier. |
| 332 | // Do not set `ThreadFlag::kRunningFlipFunction` as no other thread can run |
| 333 | // the flip function for a thread that is not suspended. |
| 334 | StateAndFlags new_state_and_flags = old_state_and_flags.WithState(ThreadState::kRunnable) |
| 335 | .WithoutFlag(ThreadFlag::kPendingFlipFunction); |
| 336 | if (LIKELY(tls32_.state_and_flags.CompareAndSetWeakAcquire(old_state_and_flags.GetValue(), |
| 337 | new_state_and_flags.GetValue()))) { |
| 338 | // Mark the acquisition of a share of the mutator lock. |
| 339 | GetMutatorLock()->TransitionFromSuspendedToRunnable(this); |
| 340 | // Run the flip function. |
| 341 | RunFlipFunction(this, /*notify=*/ false); |
| 342 | break; |
| 343 | } |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 344 | } |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 345 | // Reload state and flags. |
Vladimir Marko | 9c0f764 | 2021-12-06 16:17:52 +0000 | [diff] [blame] | 346 | old_state_and_flags = GetStateAndFlags(std::memory_order_relaxed); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 347 | DCHECK_EQ(old_state, old_state_and_flags.GetState()); |
| 348 | } |
Yu Li | eac4424 | 2015-06-29 10:50:03 +0800 | [diff] [blame] | 349 | return static_cast<ThreadState>(old_state); |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 350 | } |
| 351 | |
Mathieu Chartier | e6da9af | 2013-12-16 11:54:42 -0800 | [diff] [blame] | 352 | inline mirror::Object* Thread::AllocTlab(size_t bytes) { |
| 353 | DCHECK_GE(TlabSize(), bytes); |
Ian Rogers | dd7624d | 2014-03-14 17:43:00 -0700 | [diff] [blame] | 354 | ++tlsPtr_.thread_local_objects; |
| 355 | mirror::Object* ret = reinterpret_cast<mirror::Object*>(tlsPtr_.thread_local_pos); |
| 356 | tlsPtr_.thread_local_pos += bytes; |
Mathieu Chartier | 692fafd | 2013-11-29 17:24:40 -0800 | [diff] [blame] | 357 | return ret; |
| 358 | } |
| 359 | |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 360 | inline bool Thread::PushOnThreadLocalAllocationStack(mirror::Object* obj) { |
Ian Rogers | dd7624d | 2014-03-14 17:43:00 -0700 | [diff] [blame] | 361 | DCHECK_LE(tlsPtr_.thread_local_alloc_stack_top, tlsPtr_.thread_local_alloc_stack_end); |
| 362 | if (tlsPtr_.thread_local_alloc_stack_top < tlsPtr_.thread_local_alloc_stack_end) { |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 363 | // There's room. |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 364 | DCHECK_LE(reinterpret_cast<uint8_t*>(tlsPtr_.thread_local_alloc_stack_top) + |
Mathieu Chartier | cb535da | 2015-01-23 13:50:03 -0800 | [diff] [blame] | 365 | sizeof(StackReference<mirror::Object>), |
Ian Rogers | 1373595 | 2014-10-08 12:43:28 -0700 | [diff] [blame] | 366 | reinterpret_cast<uint8_t*>(tlsPtr_.thread_local_alloc_stack_end)); |
Mathieu Chartier | cb535da | 2015-01-23 13:50:03 -0800 | [diff] [blame] | 367 | DCHECK(tlsPtr_.thread_local_alloc_stack_top->AsMirrorPtr() == nullptr); |
| 368 | tlsPtr_.thread_local_alloc_stack_top->Assign(obj); |
Ian Rogers | dd7624d | 2014-03-14 17:43:00 -0700 | [diff] [blame] | 369 | ++tlsPtr_.thread_local_alloc_stack_top; |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 370 | return true; |
| 371 | } |
| 372 | return false; |
| 373 | } |
| 374 | |
Hans Boehm | 1b3ec0f | 2022-01-26 16:53:07 +0000 | [diff] [blame^] | 375 | inline bool Thread::GetWeakRefAccessEnabled() const { |
| 376 | CHECK(kUseReadBarrier); |
| 377 | DCHECK(this == Thread::Current()); |
| 378 | WeakRefAccessState s = tls32_.weak_ref_access_enabled.load(std::memory_order_acquire); |
| 379 | if (s == WeakRefAccessState::kVisiblyEnabled) { |
| 380 | return true; |
| 381 | } else if (s == WeakRefAccessState::kDisabled) { |
| 382 | return false; |
| 383 | } |
| 384 | DCHECK(s == WeakRefAccessState::kEnabled) |
| 385 | << "state = " << static_cast<std::underlying_type_t<WeakRefAccessState>>(s); |
| 386 | // The state is only changed back to DISABLED during a checkpoint. Thus no other thread can |
| 387 | // change the value concurrently here. No other thread reads the value we store here, so there |
| 388 | // is no need for a release store. |
| 389 | tls32_.weak_ref_access_enabled.store(WeakRefAccessState::kVisiblyEnabled, |
| 390 | std::memory_order_relaxed); |
| 391 | return true; |
| 392 | } |
| 393 | |
Mathieu Chartier | cb535da | 2015-01-23 13:50:03 -0800 | [diff] [blame] | 394 | inline void Thread::SetThreadLocalAllocationStack(StackReference<mirror::Object>* start, |
| 395 | StackReference<mirror::Object>* end) { |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 396 | DCHECK(Thread::Current() == this) << "Should be called by self"; |
| 397 | DCHECK(start != nullptr); |
| 398 | DCHECK(end != nullptr); |
Mathieu Chartier | cb535da | 2015-01-23 13:50:03 -0800 | [diff] [blame] | 399 | DCHECK_ALIGNED(start, sizeof(StackReference<mirror::Object>)); |
| 400 | DCHECK_ALIGNED(end, sizeof(StackReference<mirror::Object>)); |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 401 | DCHECK_LT(start, end); |
Ian Rogers | dd7624d | 2014-03-14 17:43:00 -0700 | [diff] [blame] | 402 | tlsPtr_.thread_local_alloc_stack_end = end; |
| 403 | tlsPtr_.thread_local_alloc_stack_top = start; |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | inline void Thread::RevokeThreadLocalAllocationStack() { |
| 407 | if (kIsDebugBuild) { |
| 408 | // Note: self is not necessarily equal to this thread since thread may be suspended. |
| 409 | Thread* self = Thread::Current(); |
Vladimir Marko | ddf4fd3 | 2021-11-22 16:31:57 +0000 | [diff] [blame] | 410 | DCHECK(this == self || IsSuspended() || GetState() == ThreadState::kWaitingPerformingGc) |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 411 | << GetState() << " thread " << this << " self " << self; |
| 412 | } |
Ian Rogers | dd7624d | 2014-03-14 17:43:00 -0700 | [diff] [blame] | 413 | tlsPtr_.thread_local_alloc_stack_end = nullptr; |
| 414 | tlsPtr_.thread_local_alloc_stack_top = nullptr; |
Hiroshi Yamauchi | f5b0e20 | 2014-02-11 17:02:22 -0800 | [diff] [blame] | 415 | } |
| 416 | |
Mathieu Chartier | a59d9b2 | 2016-09-26 18:13:17 -0700 | [diff] [blame] | 417 | inline void Thread::PoisonObjectPointersIfDebug() { |
Andreas Gampe | c73cb64 | 2017-02-22 10:11:30 -0800 | [diff] [blame] | 418 | if (kObjPtrPoisoning) { |
Mathieu Chartier | a59d9b2 | 2016-09-26 18:13:17 -0700 | [diff] [blame] | 419 | Thread::Current()->PoisonObjectPointers(); |
| 420 | } |
| 421 | } |
| 422 | |
Hiroshi Yamauchi | 02e7f1a | 2016-10-03 15:32:01 -0700 | [diff] [blame] | 423 | inline bool Thread::ModifySuspendCount(Thread* self, |
| 424 | int delta, |
| 425 | AtomicInteger* suspend_barrier, |
Alex Light | 46f9340 | 2017-06-29 11:59:50 -0700 | [diff] [blame] | 426 | SuspendReason reason) { |
Hiroshi Yamauchi | 02e7f1a | 2016-10-03 15:32:01 -0700 | [diff] [blame] | 427 | if (delta > 0 && ((kUseReadBarrier && this != self) || suspend_barrier != nullptr)) { |
| 428 | // When delta > 0 (requesting a suspend), ModifySuspendCountInternal() may fail either if |
| 429 | // active_suspend_barriers is full or we are in the middle of a thread flip. Retry in a loop. |
| 430 | while (true) { |
Alex Light | 46f9340 | 2017-06-29 11:59:50 -0700 | [diff] [blame] | 431 | if (LIKELY(ModifySuspendCountInternal(self, delta, suspend_barrier, reason))) { |
Hiroshi Yamauchi | 02e7f1a | 2016-10-03 15:32:01 -0700 | [diff] [blame] | 432 | return true; |
| 433 | } else { |
| 434 | // Failure means the list of active_suspend_barriers is full or we are in the middle of a |
| 435 | // thread flip, we should release the thread_suspend_count_lock_ (to avoid deadlock) and |
| 436 | // wait till the target thread has executed or Thread::PassActiveSuspendBarriers() or the |
| 437 | // flip function. Note that we could not simply wait for the thread to change to a suspended |
| 438 | // state, because it might need to run checkpoint function before the state change or |
| 439 | // resumes from the resume_cond_, which also needs thread_suspend_count_lock_. |
| 440 | // |
| 441 | // The list of active_suspend_barriers is very unlikely to be full since more than |
| 442 | // kMaxSuspendBarriers threads need to execute SuspendAllInternal() simultaneously, and |
| 443 | // target thread stays in kRunnable in the mean time. |
| 444 | Locks::thread_suspend_count_lock_->ExclusiveUnlock(self); |
| 445 | NanoSleep(100000); |
| 446 | Locks::thread_suspend_count_lock_->ExclusiveLock(self); |
| 447 | } |
| 448 | } |
| 449 | } else { |
Alex Light | 46f9340 | 2017-06-29 11:59:50 -0700 | [diff] [blame] | 450 | return ModifySuspendCountInternal(self, delta, suspend_barrier, reason); |
Hiroshi Yamauchi | 02e7f1a | 2016-10-03 15:32:01 -0700 | [diff] [blame] | 451 | } |
| 452 | } |
| 453 | |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 454 | inline ShadowFrame* Thread::PushShadowFrame(ShadowFrame* new_top_frame) { |
Nicolas Geoffray | 893147c | 2018-10-29 14:49:30 +0000 | [diff] [blame] | 455 | new_top_frame->CheckConsistentVRegs(); |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 456 | return tlsPtr_.managed_stack.PushShadowFrame(new_top_frame); |
| 457 | } |
| 458 | |
| 459 | inline ShadowFrame* Thread::PopShadowFrame() { |
| 460 | return tlsPtr_.managed_stack.PopShadowFrame(); |
| 461 | } |
| 462 | |
Andreas Gampe | 639b2b1 | 2019-01-08 10:32:50 -0800 | [diff] [blame] | 463 | inline uint8_t* Thread::GetStackEndForInterpreter(bool implicit_overflow_check) const { |
| 464 | uint8_t* end = tlsPtr_.stack_end + (implicit_overflow_check |
| 465 | ? GetStackOverflowReservedBytes(kRuntimeISA) |
| 466 | : 0); |
| 467 | if (kIsDebugBuild) { |
| 468 | // In a debuggable build, but especially under ASAN, the access-checks interpreter has a |
| 469 | // potentially humongous stack size. We don't want to take too much of the stack regularly, |
| 470 | // so do not increase the regular reserved size (for compiled code etc) and only report the |
| 471 | // virtually smaller stack to the interpreter here. |
| 472 | end += GetStackOverflowReservedBytes(kRuntimeISA); |
| 473 | } |
| 474 | return end; |
| 475 | } |
| 476 | |
| 477 | inline void Thread::ResetDefaultStackEnd() { |
| 478 | // Our stacks grow down, so we want stack_end_ to be near there, but reserving enough room |
| 479 | // to throw a StackOverflowError. |
| 480 | tlsPtr_.stack_end = tlsPtr_.stack_begin + GetStackOverflowReservedBytes(kRuntimeISA); |
| 481 | } |
| 482 | |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 483 | } // namespace art |
| 484 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 485 | #endif // ART_RUNTIME_THREAD_INL_H_ |