Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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_SCOPED_THREAD_STATE_CHANGE_H_ |
| 18 | #define ART_RUNTIME_SCOPED_THREAD_STATE_CHANGE_H_ |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 19 | |
Elliott Hughes | 1aa246d | 2012-12-13 09:29:36 -0800 | [diff] [blame] | 20 | #include "base/casts.h" |
Ian Rogers | 693ff61 | 2013-02-01 10:56:12 -0800 | [diff] [blame] | 21 | #include "thread-inl.h" |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 22 | |
| 23 | namespace art { |
| 24 | |
| 25 | // Scoped change into and out of a particular state. Handles Runnable transitions that require |
| 26 | // more complicated suspension checking. The subclasses ScopedObjectAccessUnchecked and |
| 27 | // ScopedObjectAccess are used to handle the change into Runnable to get direct access to objects, |
| 28 | // the unchecked variant doesn't aid annotalysis. |
| 29 | class ScopedThreadStateChange { |
| 30 | public: |
| 31 | ScopedThreadStateChange(Thread* self, ThreadState new_thread_state) |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 32 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) ALWAYS_INLINE |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 33 | : self_(self), thread_state_(new_thread_state), expected_has_no_thread_(false) { |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame] | 34 | if (UNLIKELY(self_ == NULL)) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 35 | // Value chosen arbitrarily and won't be used in the destructor since thread_ == NULL. |
| 36 | old_thread_state_ = kTerminated; |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 37 | MutexLock mu(NULL, *Locks::runtime_shutdown_lock_); |
Ian Rogers | 120f1c7 | 2012-09-28 17:17:10 -0700 | [diff] [blame] | 38 | Runtime* runtime = Runtime::Current(); |
| 39 | CHECK(runtime == NULL || !runtime->IsStarted() || runtime->IsShuttingDown()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 40 | } else { |
| 41 | bool runnable_transition; |
Ian Rogers | 22f454c | 2012-09-08 11:06:29 -0700 | [diff] [blame] | 42 | DCHECK_EQ(self, Thread::Current()); |
| 43 | // Read state without locks, ok as state is effectively thread local and we're not interested |
| 44 | // in the suspend count (this will be handled in the runnable transitions). |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 45 | old_thread_state_ = self->GetState(); |
Ian Rogers | 22f454c | 2012-09-08 11:06:29 -0700 | [diff] [blame] | 46 | runnable_transition = old_thread_state_ == kRunnable || new_thread_state == kRunnable; |
| 47 | if (!runnable_transition) { |
| 48 | // A suspended transition to another effectively suspended transition, ok to use Unsafe. |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 49 | self_->SetState(new_thread_state); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 50 | } |
Mathieu Chartier | 858f1c5 | 2012-10-17 17:45:55 -0700 | [diff] [blame] | 51 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 52 | if (runnable_transition && old_thread_state_ != new_thread_state) { |
| 53 | if (new_thread_state == kRunnable) { |
| 54 | self_->TransitionFromSuspendedToRunnable(); |
| 55 | } else { |
| 56 | DCHECK_EQ(old_thread_state_, kRunnable); |
| 57 | self_->TransitionFromRunnableToSuspended(new_thread_state); |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 63 | ~ScopedThreadStateChange() LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) ALWAYS_INLINE { |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame] | 64 | if (UNLIKELY(self_ == NULL)) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 65 | if (!expected_has_no_thread_) { |
Ian Rogers | 50b35e2 | 2012-10-04 10:09:15 -0700 | [diff] [blame] | 66 | MutexLock mu(NULL, *Locks::runtime_shutdown_lock_); |
Ian Rogers | 120f1c7 | 2012-09-28 17:17:10 -0700 | [diff] [blame] | 67 | Runtime* runtime = Runtime::Current(); |
| 68 | bool shutting_down = (runtime == NULL) || runtime->IsShuttingDown(); |
| 69 | CHECK(shutting_down); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 70 | } |
| 71 | } else { |
| 72 | if (old_thread_state_ != thread_state_) { |
| 73 | if (old_thread_state_ == kRunnable) { |
| 74 | self_->TransitionFromSuspendedToRunnable(); |
| 75 | } else if (thread_state_ == kRunnable) { |
| 76 | self_->TransitionFromRunnableToSuspended(old_thread_state_); |
| 77 | } else { |
Ian Rogers | 22f454c | 2012-09-08 11:06:29 -0700 | [diff] [blame] | 78 | // A suspended transition to another effectively suspended transition, ok to use Unsafe. |
Ian Rogers | 474b6da | 2012-09-25 00:20:38 -0700 | [diff] [blame] | 79 | self_->SetState(old_thread_state_); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 80 | } |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | Thread* Self() const { |
| 86 | return self_; |
| 87 | } |
| 88 | |
| 89 | protected: |
| 90 | // Constructor used by ScopedJniThreadState for an unattached thread that has access to the VM*. |
| 91 | ScopedThreadStateChange() |
| 92 | : self_(NULL), thread_state_(kTerminated), old_thread_state_(kTerminated), |
| 93 | expected_has_no_thread_(true) {} |
| 94 | |
| 95 | Thread* const self_; |
| 96 | const ThreadState thread_state_; |
| 97 | |
| 98 | private: |
| 99 | ThreadState old_thread_state_; |
| 100 | const bool expected_has_no_thread_; |
| 101 | |
| 102 | DISALLOW_COPY_AND_ASSIGN(ScopedThreadStateChange); |
| 103 | }; |
| 104 | |
| 105 | // Entry/exit processing for transitions from Native to Runnable (ie within JNI functions). |
| 106 | // |
| 107 | // This class performs the necessary thread state switching to and from Runnable and lets us |
| 108 | // amortize the cost of working out the current thread. Additionally it lets us check (and repair) |
| 109 | // apps that are using a JNIEnv on the wrong thread. The class also decodes and encodes Objects |
| 110 | // into jobjects via methods of this class. Performing this here enforces the Runnable thread state |
| 111 | // for use of Object, thereby inhibiting the Object being modified by GC whilst native or VM code |
| 112 | // is also manipulating the Object. |
| 113 | // |
| 114 | // The destructor transitions back to the previous thread state, typically Native. In this state |
| 115 | // GC and thread suspension may occur. |
| 116 | // |
| 117 | // For annotalysis the subclass ScopedObjectAccess (below) makes it explicit that a shared of |
| 118 | // the mutator_lock_ will be acquired on construction. |
| 119 | class ScopedObjectAccessUnchecked : public ScopedThreadStateChange { |
| 120 | public: |
| 121 | explicit ScopedObjectAccessUnchecked(JNIEnv* env) |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 122 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) ALWAYS_INLINE |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 123 | : ScopedThreadStateChange(ThreadForEnv(env), kRunnable), |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame^] | 124 | env_(down_cast<JNIEnvExt*>(env)), vm_(env_->vm) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 125 | self_->VerifyStack(); |
| 126 | } |
| 127 | |
| 128 | explicit ScopedObjectAccessUnchecked(Thread* self) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 129 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 130 | : ScopedThreadStateChange(self, kRunnable), |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame^] | 131 | env_(down_cast<JNIEnvExt*>(self->GetJniEnv())), |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 132 | vm_(env_ != NULL ? env_->vm : NULL) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 133 | self_->VerifyStack(); |
| 134 | } |
| 135 | |
| 136 | // Used when we want a scoped JNI thread state but have no thread/JNIEnv. Consequently doesn't |
| 137 | // change into Runnable or acquire a share on the mutator_lock_. |
| 138 | explicit ScopedObjectAccessUnchecked(JavaVM* vm) |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame^] | 139 | : ScopedThreadStateChange(), env_(NULL), vm_(down_cast<JavaVMExt*>(vm)) {} |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 140 | |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 141 | // Here purely to force inlining. |
| 142 | ~ScopedObjectAccessUnchecked() ALWAYS_INLINE { |
Ian Rogers | c0fa3ad | 2013-02-05 00:11:55 -0800 | [diff] [blame] | 143 | } |
| 144 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 145 | JNIEnvExt* Env() const { |
| 146 | return env_; |
| 147 | } |
| 148 | |
| 149 | JavaVMExt* Vm() const { |
| 150 | return vm_; |
| 151 | } |
| 152 | |
| 153 | /* |
| 154 | * Add a local reference for an object to the indirect reference table associated with the |
| 155 | * current stack frame. When the native function returns, the reference will be discarded. |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 156 | * |
Elliott Hughes | 9dcd45c | 2013-07-29 14:40:52 -0700 | [diff] [blame] | 157 | * We need to allow the same reference to be added multiple times, and cope with NULL. |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 158 | * |
Elliott Hughes | 9dcd45c | 2013-07-29 14:40:52 -0700 | [diff] [blame] | 159 | * This will be called on otherwise unreferenced objects. We cannot do GC allocations here, and |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 160 | * it's best if we don't grab a mutex. |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 161 | */ |
| 162 | template<typename T> |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 163 | T AddLocalReference(mirror::Object* obj) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 1eb512d | 2013-10-18 15:42:20 -0700 | [diff] [blame^] | 164 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 165 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 166 | if (obj == NULL) { |
| 167 | return NULL; |
| 168 | } |
| 169 | |
| 170 | DCHECK_NE((reinterpret_cast<uintptr_t>(obj) & 0xffff0000), 0xebad0000); |
| 171 | |
| 172 | IndirectReferenceTable& locals = Env()->locals; |
| 173 | |
| 174 | uint32_t cookie = Env()->local_ref_cookie; |
| 175 | IndirectRef ref = locals.Add(cookie, obj); |
| 176 | |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 177 | #if 0 // TODO: fix this to understand PushLocalFrame, so we can turn it on. |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 178 | if (Env()->check_jni) { |
| 179 | size_t entry_count = locals.Capacity(); |
| 180 | if (entry_count > 16) { |
| 181 | LOG(WARNING) << "Warning: more than 16 JNI local references: " |
| 182 | << entry_count << " (most recent was a " << PrettyTypeOf(obj) << ")\n" |
| 183 | << Dumpable<IndirectReferenceTable>(locals); |
| 184 | // TODO: LOG(FATAL) in a later release? |
| 185 | } |
| 186 | } |
| 187 | #endif |
| 188 | |
| 189 | if (Vm()->work_around_app_jni_bugs) { |
| 190 | // Hand out direct pointers to support broken old apps. |
| 191 | return reinterpret_cast<T>(obj); |
| 192 | } |
| 193 | |
| 194 | return reinterpret_cast<T>(ref); |
| 195 | } |
| 196 | |
| 197 | template<typename T> |
| 198 | T Decode(jobject obj) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 199 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 200 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 201 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 202 | return down_cast<T>(Self()->DecodeJObject(obj)); |
| 203 | } |
| 204 | |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 205 | mirror::ArtField* DecodeField(jfieldID fid) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 206 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 207 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 208 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 209 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 210 | // TODO: we should make these unique weak globals if Field instances can ever move. |
| 211 | UNIMPLEMENTED(WARNING); |
| 212 | #endif |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 213 | return reinterpret_cast<mirror::ArtField*>(fid); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 214 | } |
| 215 | |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 216 | jfieldID EncodeField(mirror::ArtField* field) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 217 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 218 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 219 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 220 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 221 | UNIMPLEMENTED(WARNING); |
| 222 | #endif |
| 223 | return reinterpret_cast<jfieldID>(field); |
| 224 | } |
| 225 | |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 226 | mirror::ArtMethod* DecodeMethod(jmethodID mid) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 227 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 228 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 229 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 230 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 231 | // TODO: we should make these unique weak globals if Method instances can ever move. |
| 232 | UNIMPLEMENTED(WARNING); |
| 233 | #endif |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 234 | return reinterpret_cast<mirror::ArtMethod*>(mid); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 235 | } |
| 236 | |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 237 | jmethodID EncodeMethod(mirror::ArtMethod* method) const |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 238 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 239 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 240 | DCHECK_EQ(thread_state_, kRunnable); // Don't work with raw objects in non-runnable states. |
| 241 | #ifdef MOVING_GARBAGE_COLLECTOR |
| 242 | UNIMPLEMENTED(WARNING); |
| 243 | #endif |
| 244 | return reinterpret_cast<jmethodID>(method); |
| 245 | } |
| 246 | |
| 247 | private: |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 248 | // The full JNIEnv. |
| 249 | JNIEnvExt* const env_; |
| 250 | // The full JavaVM. |
| 251 | JavaVMExt* const vm_; |
| 252 | |
| 253 | DISALLOW_COPY_AND_ASSIGN(ScopedObjectAccessUnchecked); |
| 254 | }; |
| 255 | |
| 256 | // Annotalysis helping variant of the above. |
| 257 | class ScopedObjectAccess : public ScopedObjectAccessUnchecked { |
| 258 | public: |
| 259 | explicit ScopedObjectAccess(JNIEnv* env) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 260 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 261 | SHARED_LOCK_FUNCTION(Locks::mutator_lock_) ALWAYS_INLINE |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 262 | : ScopedObjectAccessUnchecked(env) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 263 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | explicit ScopedObjectAccess(Thread* self) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 267 | LOCKS_EXCLUDED(Locks::thread_suspend_count_lock_) |
| 268 | SHARED_LOCK_FUNCTION(Locks::mutator_lock_) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 269 | : ScopedObjectAccessUnchecked(self) { |
Ian Rogers | 81d425b | 2012-09-27 16:03:43 -0700 | [diff] [blame] | 270 | Locks::mutator_lock_->AssertSharedHeld(Self()); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 271 | } |
| 272 | |
Ian Rogers | 1ffa32f | 2013-02-05 18:29:08 -0800 | [diff] [blame] | 273 | ~ScopedObjectAccess() UNLOCK_FUNCTION(Locks::mutator_lock_) ALWAYS_INLINE { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 274 | // Base class will release share of lock. Invoked after this destructor. |
| 275 | } |
| 276 | |
| 277 | private: |
| 278 | // TODO: remove this constructor. It is used by check JNI's ScopedCheck to make it believe that |
| 279 | // routines operating with just a VM are sound, they are not, but when you have just a VM |
| 280 | // you cannot call the unsound routines. |
| 281 | explicit ScopedObjectAccess(JavaVM* vm) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 282 | SHARED_LOCK_FUNCTION(Locks::mutator_lock_) |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 283 | : ScopedObjectAccessUnchecked(vm) {} |
| 284 | |
| 285 | friend class ScopedCheck; |
| 286 | DISALLOW_COPY_AND_ASSIGN(ScopedObjectAccess); |
| 287 | }; |
| 288 | |
| 289 | } // namespace art |
| 290 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 291 | #endif // ART_RUNTIME_SCOPED_THREAD_STATE_CHANGE_H_ |