summaryrefslogtreecommitdiff
path: root/runtime/scoped_thread_state_change.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2017-04-21 12:09:39 -0700
committer Andreas Gampe <agampe@google.com> 2017-04-21 16:48:00 -0700
commitc15a2f4f45661a7f5f542e406282c146ea1a968d (patch)
tree50ad6104b0b8739f272782c35a7022cca64d2601 /runtime/scoped_thread_state_change.h
parent9ae527f615f61aec4aaca310c52f373e8c3d8d58 (diff)
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
Diffstat (limited to 'runtime/scoped_thread_state_change.h')
-rw-r--r--runtime/scoped_thread_state_change.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/runtime/scoped_thread_state_change.h b/runtime/scoped_thread_state_change.h
index 5f03741d1f..02b6124118 100644
--- a/runtime/scoped_thread_state_change.h
+++ b/runtime/scoped_thread_state_change.h
@@ -17,17 +17,23 @@
#ifndef ART_RUNTIME_SCOPED_THREAD_STATE_CHANGE_H_
#define ART_RUNTIME_SCOPED_THREAD_STATE_CHANGE_H_
-#include "art_field.h"
-#include "base/casts.h"
+#include "jni.h"
+
+#include "base/macros.h"
+#include "base/mutex.h"
#include "base/value_object.h"
-#include "java_vm_ext.h"
#include "thread_state.h"
-#include "verify_object.h"
namespace art {
+class JavaVMExt;
struct JNIEnvExt;
template<class MirrorType> class ObjPtr;
+class Thread;
+
+namespace mirror {
+class Object;
+} // namespace mirror
// Scoped change into and out of a particular state. Handles Runnable transitions that require
// more complicated suspension checking. The subclasses ScopedObjectAccessUnchecked and
@@ -74,9 +80,7 @@ class ScopedObjectAccessAlreadyRunnable : public ValueObject {
return vm_;
}
- bool ForceCopy() const {
- return vm_->ForceCopy();
- }
+ bool ForceCopy() const;
/*
* Add a local reference for an object to the indirect reference table associated with the
@@ -105,12 +109,17 @@ class ScopedObjectAccessAlreadyRunnable : public ValueObject {
// Used when we want a scoped JNI thread state but have no thread/JNIEnv. Consequently doesn't
// change into Runnable or acquire a share on the mutator_lock_.
+ // Note: The reinterpret_cast is backed by a static_assert in the cc file. Avoid a down_cast,
+ // as it prevents forward declaration of JavaVMExt.
explicit ScopedObjectAccessAlreadyRunnable(JavaVM* vm)
- : self_(nullptr), env_(nullptr), vm_(down_cast<JavaVMExt*>(vm)) {}
+ : self_(nullptr), env_(nullptr), vm_(reinterpret_cast<JavaVMExt*>(vm)) {}
// Here purely to force inlining.
ALWAYS_INLINE ~ScopedObjectAccessAlreadyRunnable() {}
+ static void DCheckObjIsNotClearedJniWeakGlobal(ObjPtr<mirror::Object> obj)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
// Self thread, can be null.
Thread* const self_;
// The full JNIEnv.