summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/class-inl.h
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2014-05-09 11:45:53 -0700
committerHiroshi Yamauchi <yamauchi@google.com>2014-05-09 11:50:32 -0700
commit25023c744c4388a6459b21cc3babf8c602b024a2 (patch)
tree6d266d8eb8ed442e1dfeb5102ed9ed38a5ee83d9 /runtime/mirror/class-inl.h
parent3d1e6642d350e23fa85d4cfcb03413a576880396 (diff)
downloadandroid_art-25023c744c4388a6459b21cc3babf8c602b024a2.tar.gz
android_art-25023c744c4388a6459b21cc3babf8c602b024a2.tar.bz2
android_art-25023c744c4388a6459b21cc3babf8c602b024a2.zip
Make it possible to disable read barriers in Class::GetObjectSize()
This is a leftover from cl/91831 (commit 9103c86a98524e9ddfd14f8cee56e919f68eee9b) that attempted to make it possible to disable read barriers in Object::SizeOf(). Bug: 12687968 Change-Id: I2b05076832936881ec61bc21b6eb6b7c04e0a1f0
Diffstat (limited to 'runtime/mirror/class-inl.h')
-rw-r--r--runtime/mirror/class-inl.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index a556a1c4fc..d454ae8469 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -33,8 +33,14 @@
namespace art {
namespace mirror {
+template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
inline uint32_t Class::GetObjectSize() {
- DCHECK(!IsVariableSize()) << " class=" << PrettyTypeOf(this);
+ if (kIsDebugBuild) {
+ // Use a local variable as (D)CHECK can't handle the space between
+ // the two template params.
+ bool is_variable_size = IsVariableSize<kVerifyFlags, kReadBarrierOption>();
+ CHECK(!is_variable_size) << " class=" << PrettyTypeOf(this);
+ }
return GetField32(OFFSET_OF_OBJECT_MEMBER(Class, object_size_));
}
@@ -514,6 +520,13 @@ bool Class::IsArtMethodClass() {
return this == ArtMethod::GetJavaLangReflectArtMethod<kReadBarrierOption>();
}
+template<VerifyObjectFlags kVerifyFlags, ReadBarrierOption kReadBarrierOption>
+inline bool Class::IsClassClass() {
+ Class* java_lang_Class = GetClass<kVerifyFlags, kReadBarrierOption>()->
+ template GetClass<kVerifyFlags, kReadBarrierOption>();
+ return this == java_lang_Class;
+}
+
} // namespace mirror
} // namespace art