template<typename T>
inline PrimitiveArray<T>* PrimitiveArray<T>::Alloc(Thread* self, size_t length) {
- DCHECK(array_class_ != NULL);
- Array* raw_array = Array::Alloc<true>(self, array_class_, length, sizeof(T),
+ Array* raw_array = Array::Alloc<true>(self, GetArrayClass(), length, sizeof(T),
Runtime::Current()->GetHeap()->GetCurrentAllocator());
return down_cast<PrimitiveArray<T>*>(raw_array);
}
#include "gc/allocator_type.h"
#include "object.h"
#include "object_callbacks.h"
+#include "read_barrier.h"
namespace art {
array_class_ = array_class;
}
- static Class* GetArrayClass() {
+ static Class* GetArrayClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(array_class_ != nullptr);
- return array_class_;
+ return ReadBarrier::BarrierForRoot<mirror::Class, kWithReadBarrier>(
+ &array_class_);
}
static void ResetArrayClass() {
#include "modifiers.h"
#include "object.h"
#include "object_callbacks.h"
+#include "read_barrier.h"
namespace art {
template<bool kTransactionActive>
void SetObj(Object* object, Object* new_value) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static Class* GetJavaLangReflectArtField() {
+ template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
+ static Class* GetJavaLangReflectArtField() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(java_lang_reflect_ArtField_ != nullptr);
- return java_lang_reflect_ArtField_;
+ return ReadBarrier::BarrierForRoot<mirror::Class, kReadBarrierOption>(
+ &java_lang_reflect_ArtField_);
}
static void SetClass(Class* java_lang_reflect_ArtField);
#include "object.h"
#include "object_callbacks.h"
#include "quick/quick_method_frame_info.h"
+#include "read_barrier.h"
namespace art {
static void SetClass(Class* java_lang_reflect_ArtMethod);
- static Class* GetJavaLangReflectArtMethod() {
+ template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
+ static Class* GetJavaLangReflectArtMethod() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(java_lang_reflect_ArtMethod_ != nullptr);
- return java_lang_reflect_ArtMethod_;
+ return ReadBarrier::BarrierForRoot<mirror::Class, kReadBarrierOption>(
+ &java_lang_reflect_ArtMethod_);
}
static void ResetClass();
VisitInstanceFieldsReferences<kVisitClass>(klass, visitor);
}
+template<ReadBarrierOption kReadBarrierOption>
inline bool Class::IsArtFieldClass() const {
- return this == ArtField::GetJavaLangReflectArtField();
+ return this == ArtField::GetJavaLangReflectArtField<kReadBarrierOption>();
}
+template<ReadBarrierOption kReadBarrierOption>
inline bool Class::IsArtMethodClass() const {
- return this == ArtMethod::GetJavaLangReflectArtMethod();
+ return this == ArtMethod::GetJavaLangReflectArtMethod<kReadBarrierOption>();
}
template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
Class* Class::java_lang_Class_ = nullptr;
void Class::SetClassClass(Class* java_lang_Class) {
- CHECK(java_lang_Class_ == nullptr) << java_lang_Class_ << " " << java_lang_Class;
+ CHECK(java_lang_Class_ == nullptr)
+ << ReadBarrier::BarrierForRoot<mirror::Class, kWithReadBarrier>(&java_lang_Class_)
+ << " " << java_lang_Class;
CHECK(java_lang_Class != nullptr);
java_lang_Class_ = java_lang_Class;
}
#include "object.h"
#include "object_callbacks.h"
#include "primitive.h"
+#include "read_barrier.h"
/*
* A magic value for refOffsets. Ignore the bits and walk the super
bool IsThrowableClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
bool IsArtFieldClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
bool IsArtMethodClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static MemberOffset ComponentTypeOffset() {
SetField32<false>(OFFSET_OF_OBJECT_MEMBER(Class, dex_type_idx_), type_idx);
}
- static Class* GetJavaLangClass() {
+ static Class* GetJavaLangClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(java_lang_Class_ != NULL);
- return java_lang_Class_;
+ return ReadBarrier::BarrierForRoot<mirror::Class, kWithReadBarrier>(
+ &java_lang_Class_);
}
// Can't call this SetClass or else gets called instead of Object::SetClass in places.
- static void SetClassClass(Class* java_lang_Class);
+ static void SetClassClass(Class* java_lang_Class) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static void ResetClass();
static void VisitRoots(RootCallback* callback, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
inline bool Object::IsArtField() {
- return GetClass<kVerifyFlags, kReadBarrierOption>()->IsArtFieldClass();
+ return GetClass<kVerifyFlags, kReadBarrierOption>()->
+ template IsArtFieldClass<kReadBarrierOption>();
}
template<VerifyObjectFlags kVerifyFlags>
template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
inline bool Object::IsArtMethod() {
- return GetClass<kVerifyFlags, kReadBarrierOption>()->IsArtMethodClass();
+ return GetClass<kVerifyFlags, kReadBarrierOption>()->
+ template IsArtMethodClass<kReadBarrierOption>();
}
template<VerifyObjectFlags kVerifyFlags>
#include "object.h"
#include "object_callbacks.h"
+#include "read_barrier.h"
namespace art {
static void ResetClass();
static void VisitRoots(RootCallback* callback, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static Class* GetStackTraceElement() {
+ static Class* GetStackTraceElement() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(java_lang_StackTraceElement_ != NULL);
- return java_lang_StackTraceElement_;
+ return ReadBarrier::BarrierForRoot<mirror::Class, kWithReadBarrier>(
+ &java_lang_StackTraceElement_);
}
private:
#include "class.h"
#include "object_callbacks.h"
+#include "read_barrier.h"
namespace art {
int32_t CompareTo(String* other) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static Class* GetJavaLangString() {
+ static Class* GetJavaLangString() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(java_lang_String_ != NULL);
- return java_lang_String_;
+ return ReadBarrier::BarrierForRoot<mirror::Class, kWithReadBarrier>(
+ &java_lang_String_);
}
static void SetClass(Class* java_lang_String);
#include "object.h"
#include "object_callbacks.h"
+#include "read_barrier.h"
#include "string.h"
namespace art {
void SetStackState(Object* state) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool IsCheckedException() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- static Class* GetJavaLangThrowable() {
+ static Class* GetJavaLangThrowable() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
DCHECK(java_lang_Throwable_ != NULL);
- return java_lang_Throwable_;
+ return ReadBarrier::BarrierForRoot<mirror::Class, kWithReadBarrier>(
+ &java_lang_Throwable_);
}
static void SetClass(Class* java_lang_Throwable);