Simplify Class::IsArtFieldClass().
Fix the slight glitch that when ImageSpace::VerifyImageAllocations()
called in ImageSpace::Create(), the ArtField and ArtMethod class roots
weren't set, which were used by DCHECKs in Object::Size(), which
VerifyImageAllocations() calls, by delaying the point of the
VerifyImageAllocations() call to Runtime::Init() at which point the
class linker has set the class roots.
To completely disable read barriers from Object::SizeOf(), the
ReadBarrierOption template parameter should have been added to
Class::GetInstanceField(), which calls GetFieldObject(), when it's
called from Class::IsArtFieldClass(). This change fixes this by
removing the need for the call, instead of adding the
ReadBarrierOption parameter.
Bug: 12687968
Change-Id: Ibbecc08f4e3b898851805d690dff8ccac55e94f2
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index d8cbb32..40c9975 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -371,15 +371,13 @@
ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
bool IsClassClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- bool IsStringClass() const;
+ bool IsStringClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
bool IsThrowableClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
- bool IsArtFieldClass() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+ bool IsArtFieldClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- template<ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
- bool IsArtMethodClass();
+ bool IsArtMethodClass() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static MemberOffset ComponentTypeOffset() {
return OFFSET_OF_OBJECT_MEMBER(Class, component_type_);