Merge "Move DCHECK into loop."
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index d29d528..be149af 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -2486,6 +2486,20 @@
context.ForAll(0, dex_file.NumClassDefs(), &visitor, init_thread_count);
}
+class InitializeArrayClassVisitor : public ClassVisitor {
+ public:
+ virtual bool operator()(mirror::Class* klass) OVERRIDE SHARED_REQUIRES(Locks::mutator_lock_) {
+ if (klass->IsArrayClass()) {
+ StackHandleScope<1> hs(Thread::Current());
+ Runtime::Current()->GetClassLinker()->EnsureInitialized(hs.Self(),
+ hs.NewHandle(klass),
+ true,
+ true);
+ }
+ return true;
+ }
+};
+
void CompilerDriver::InitializeClasses(jobject class_loader,
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings) {
@@ -2494,6 +2508,14 @@
CHECK(dex_file != nullptr);
InitializeClasses(class_loader, *dex_file, dex_files, timings);
}
+ {
+ // Make sure that we call EnsureIntiailized on all the array classes to call
+ // SetVerificationAttempted so that the access flags are set. If we do not do this they get
+ // changed at runtime resulting in more dirty image pages.
+ ScopedObjectAccess soa(Thread::Current());
+ InitializeArrayClassVisitor visitor;
+ Runtime::Current()->GetClassLinker()->VisitClasses(&visitor);
+ }
if (IsBootImage()) {
// Prune garbage objects created during aborted transactions.
Runtime::Current()->GetHeap()->CollectGarbage(true);
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 7060593..d73f205 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3786,7 +3786,9 @@
while (old_status == mirror::Class::kStatusVerifying ||
old_status == mirror::Class::kStatusVerifyingAtRuntime) {
lock.WaitIgnoringInterrupts();
- CHECK_GT(klass->GetStatus(), old_status);
+ CHECK(klass->IsErroneous() || (klass->GetStatus() > old_status))
+ << "Class '" << PrettyClass(klass.Get()) << "' performed an illegal verification state "
+ << "transition from " << old_status << " to " << klass->GetStatus();
old_status = klass->GetStatus();
}
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 421641c..5d89c21 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -426,7 +426,9 @@
if (error_msg != nullptr) {
auto saved_errno = errno;
- PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
+ if (kIsDebugBuild || VLOG_IS_ON(oat)) {
+ PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
+ }
*error_msg = StringPrintf("mmap(%p, %zd, 0x%x, 0x%x, %d, %" PRId64
") of file '%s' failed: %s. See process maps in the log.",
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index 7082c88..9808c3e 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -299,7 +299,9 @@
// Mutually exclusive from whether or not each method is allowed to skip access checks.
void SetVerificationAttempted() SHARED_REQUIRES(Locks::mutator_lock_) {
uint32_t flags = GetField32(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_));
- SetAccessFlags(flags | kAccVerificationAttempted);
+ if ((flags & kAccVerificationAttempted) == 0) {
+ SetAccessFlags(flags | kAccVerificationAttempted);
+ }
}
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 7c83715..c60962b 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -173,7 +173,7 @@
}
if (requested_base != nullptr && begin_ != requested_base) {
// Host can fail this check. Do not dump there to avoid polluting the output.
- if (kIsTargetBuild) {
+ if (kIsTargetBuild && (kIsDebugBuild || VLOG_IS_ON(oat))) {
PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
}
*error_msg = StringPrintf("Failed to find oatdata symbol at expected address: "