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
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 025e62a..3c02aa0 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -478,6 +478,19 @@
VisitStaticFieldsReferences<kVisitClass>(this, visitor);
}
+template<bool kDoReadBarrier>
+bool Class::IsArtFieldClass() {
+ Class* java_lang_Class = GetClass<kVerifyNone, kDoReadBarrier>();
+ Class* java_lang_reflect_ArtField =
+ java_lang_Class->GetInstanceField(0)->GetClass<kVerifyNone, kDoReadBarrier>();
+ return this == java_lang_reflect_ArtField;
+}
+
+template<bool kDoReadBarrier>
+bool Class::IsArtMethodClass() {
+ return this == ArtMethod::GetJavaLangReflectArtMethod<kDoReadBarrier>();
+}
+
} // namespace mirror
} // namespace art