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/array-inl.h b/runtime/mirror/array-inl.h
index 3d2fd7b..7f974d0 100644
--- a/runtime/mirror/array-inl.h
+++ b/runtime/mirror/array-inl.h
@@ -27,10 +27,11 @@
namespace art {
namespace mirror {
-template<VerifyObjectFlags kVerifyFlags>
+template<VerifyObjectFlags kVerifyFlags, bool kDoReadBarrier>
inline size_t Array::SizeOf() {
// This is safe from overflow because the array was already allocated, so we know it's sane.
- size_t component_size = GetClass<kVerifyFlags>()->GetComponentSize();
+ size_t component_size =
+ GetClass<kVerifyFlags, kDoReadBarrier>()->template GetComponentSize<kDoReadBarrier>();
// Don't need to check this since we already check this in GetClass.
int32_t component_count =
GetLength<static_cast<VerifyObjectFlags>(kVerifyFlags & ~kVerifyThis)>();