ART: Add object-readbarrier-inl.h
Move some read-barrier code into a new header. This prunes the
include tree for the concurrent-copying collector. Clean up other
related includes.
Test: mmma art
Change-Id: I40ce4e74f2e5d4c692529ffb4df933230b6fd73e
diff --git a/runtime/scoped_thread_state_change-inl.h b/runtime/scoped_thread_state_change-inl.h
index c817a9e..ed6e349 100644
--- a/runtime/scoped_thread_state_change-inl.h
+++ b/runtime/scoped_thread_state_change-inl.h
@@ -19,6 +19,7 @@
#include "scoped_thread_state_change.h"
+#include "base/casts.h"
#include "jni_env_ext-inl.h"
#include "obj_ptr-inl.h"
#include "thread-inl.h"
@@ -74,8 +75,10 @@
template<typename T>
inline T ScopedObjectAccessAlreadyRunnable::AddLocalReference(ObjPtr<mirror::Object> obj) const {
Locks::mutator_lock_->AssertSharedHeld(Self());
- DCHECK(IsRunnable()); // Don't work with raw objects in non-runnable states.
- DCHECK_NE(obj, Runtime::Current()->GetClearedJniWeakGlobal());
+ if (kIsDebugBuild) {
+ CHECK(IsRunnable()); // Don't work with raw objects in non-runnable states.
+ DCheckObjIsNotClearedJniWeakGlobal(obj);
+ }
return obj == nullptr ? nullptr : Env()->AddLocalReference<T>(obj);
}