summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/class.h
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2014-04-22 13:51:07 -0700
committerHiroshi Yamauchi <yamauchi@google.com>2014-04-22 14:26:21 -0700
commit9103c86a98524e9ddfd14f8cee56e919f68eee9b (patch)
tree69e64a2f618e10bb8f060cf7fb70c8e94dc43b50 /runtime/mirror/class.h
parentf7933e7f295bfe61cb0baf89469581c563032e96 (diff)
downloadart-9103c86a98524e9ddfd14f8cee56e919f68eee9b.zip
art-9103c86a98524e9ddfd14f8cee56e919f68eee9b.tar.gz
art-9103c86a98524e9ddfd14f8cee56e919f68eee9b.tar.bz2
More code for the read barrier support.
Make it possible to disable the RB in Object::SizeOf() (and the functions it calls transitively) which the collector will need to call to get the size of an object when copying. Add Object::AtomicSetReadBarrierPointer() for atomic write of a RB pointer. Bug: 12687968 Change-Id: Ibedd252860ac7ccd17e4e7d71b377a8892b48ff0
Diffstat (limited to 'runtime/mirror/class.h')
-rw-r--r--runtime/mirror/class.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index d955b97..226dee0 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -364,9 +364,9 @@ class MANAGED Class : public Object {
return depth;
}
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
+ template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags, bool kDoReadBarrier = true>
bool IsArrayClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetComponentType<kVerifyFlags>() != NULL;
+ return GetComponentType<kVerifyFlags, kDoReadBarrier>() != NULL;
}
bool IsClassClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
@@ -375,17 +375,19 @@ class MANAGED Class : public Object {
bool IsThrowableClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ template<bool kDoReadBarrier = true>
bool IsArtFieldClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ template<bool kDoReadBarrier = true>
bool IsArtMethodClass();
static MemberOffset ComponentTypeOffset() {
return OFFSET_OF_OBJECT_MEMBER(Class, component_type_);
}
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
+ template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags, bool kDoReadBarrier = true>
Class* GetComponentType() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return GetFieldObject<Class, kVerifyFlags>(ComponentTypeOffset(), false);
+ return GetFieldObject<Class, kVerifyFlags, kDoReadBarrier>(ComponentTypeOffset(), false);
}
void SetComponentType(Class* new_component_type) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -395,8 +397,10 @@ class MANAGED Class : public Object {
SetFieldObject<false, false>(ComponentTypeOffset(), new_component_type, false);
}
+ template<bool kDoReadBarrier = true>
size_t GetComponentSize() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
- return Primitive::ComponentSize(GetComponentType()->GetPrimitiveType());
+ return Primitive::ComponentSize(
+ GetComponentType<kDefaultVerifyFlags, kDoReadBarrier>()->GetPrimitiveType());
}
bool IsObjectClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
@@ -427,7 +431,7 @@ class MANAGED Class : public Object {
return IsClassClass() || IsArrayClass();
}
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
+ template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags, bool kDoReadBarrier = true>
uint32_t SizeOf() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return GetField32<kVerifyFlags>(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), false);
}