summaryrefslogtreecommitdiff
path: root/runtime/mirror/array.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/mirror/array.h')
-rw-r--r--runtime/mirror/array.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/runtime/mirror/array.h b/runtime/mirror/array.h
index 6588b57b8a..7af88d6d86 100644
--- a/runtime/mirror/array.h
+++ b/runtime/mirror/array.h
@@ -17,10 +17,10 @@
#ifndef ART_RUNTIME_MIRROR_ARRAY_H_
#define ART_RUNTIME_MIRROR_ARRAY_H_
+#include "gc_root.h"
#include "gc/allocator_type.h"
#include "object.h"
#include "object_callbacks.h"
-#include "read_barrier.h"
namespace art {
@@ -159,27 +159,26 @@ class MANAGED PrimitiveArray : public Array {
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static void SetArrayClass(Class* array_class) {
- CHECK(array_class_ == nullptr);
+ CHECK(array_class_.IsNull());
CHECK(array_class != nullptr);
- array_class_ = array_class;
+ array_class_ = GcRoot<Class>(array_class);
}
static Class* GetArrayClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- DCHECK(array_class_ != nullptr);
- return ReadBarrier::BarrierForRoot<mirror::Class, kWithReadBarrier>(
- &array_class_);
+ DCHECK(!array_class_.IsNull());
+ return array_class_.Read();
}
static void ResetArrayClass() {
- CHECK(array_class_ != nullptr);
- array_class_ = nullptr;
+ CHECK(!array_class_.IsNull());
+ array_class_ = GcRoot<Class>(nullptr);
}
static void VisitRoots(RootCallback* callback, void* arg)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
private:
- static Class* array_class_;
+ static GcRoot<Class> array_class_;
DISALLOW_IMPLICIT_CONSTRUCTORS(PrimitiveArray);
};