Make the support code for read barriers a bit more general.
Add an option for Baker in addition to Brooks.
Bug: 12687968
Change-Id: I8a31db817ff6686c72951b6534f588228e270b11
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index bb52c66..9a2815a 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -166,10 +166,8 @@
mirror::Object* obj = reinterpret_cast<mirror::Object*>(current);
CHECK(live_bitmap_->Test(obj));
CHECK(obj->GetClass() != nullptr) << "Image object at address " << obj << " has null class";
- if (kUseBrooksPointer) {
- CHECK(obj->GetBrooksPointer() == obj)
- << "Bad Brooks pointer: obj=" << reinterpret_cast<void*>(obj)
- << " brooks_ptr=" << reinterpret_cast<void*>(obj->GetBrooksPointer());
+ if (kUseBakerOrBrooksReadBarrier) {
+ obj->AssertReadBarrierPointer();
}
current += RoundUp(obj->SizeOf(), kObjectAlignment);
}