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/runtime.cc b/runtime/runtime.cc
index 95a6b39..dcbf42d 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -622,6 +622,9 @@
class_linker_ = new ClassLinker(intern_table_);
if (GetHeap()->HasImageSpace()) {
class_linker_->InitFromImage();
+ if (kIsDebugBuild) {
+ GetHeap()->GetImageSpace()->VerifyImageAllocations();
+ }
} else {
CHECK(options->boot_class_path_ != NULL);
CHECK_NE(options->boot_class_path_->size(), 0U);