diff options
author | 2020-02-25 20:31:05 +0000 | |
---|---|---|
committer | 2020-02-26 00:18:37 +0000 | |
commit | bbec8a6fc720ee5ce572d3fb63617fb0af6addc7 (patch) | |
tree | 62cfdd7f36d93e41cb57af0d61e8f7c1f9ee3b55 | |
parent | 6972b9631cb85249ab35cf9f443890089733d022 (diff) |
Revert "If generating an image, run initialization and other optimizations."
This reverts commit ada8536c19e57cbfe55dcb3c72aa95e79365ed21.
Reason for revert: test failures
Change-Id: I8640fe842d7f2255b5749403c798094f9e365fda
-rw-r--r-- | compiler/driver/compiler_options.h | 4 | ||||
-rw-r--r-- | dex2oat/driver/compiler_driver.cc | 93 | ||||
-rw-r--r-- | dex2oat/driver/compiler_driver_test.cc | 2 |
3 files changed, 47 insertions, 52 deletions
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index 79ba1c27c9..747205e4e5 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -195,10 +195,6 @@ class CompilerOptions final { return implicit_suspend_checks_; } - bool IsGeneratingImage() const { - return IsBootImage() || IsBootImageExtension() || IsAppImage(); - } - // Are we compiling a boot image? bool IsBootImage() const { return image_type_ == ImageType::kBootImage; diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc index 7707ab6699..6792a595a9 100644 --- a/dex2oat/driver/compiler_driver.cc +++ b/dex2oat/driver/compiler_driver.cc @@ -887,56 +887,55 @@ void CompilerDriver::PreCompile(jobject class_loader, if (compiler_options_->AssumeClassesAreVerified()) { VLOG(compiler) << "Verify none mode specified, skipping verification."; SetVerified(class_loader, dex_files, timings); - } else if (compiler_options_->IsVerificationEnabled()) { - Verify(class_loader, dex_files, timings, verification_results); - VLOG(compiler) << "Verify: " << GetMemoryUsageString(false); - - if (GetCompilerOptions().IsForceDeterminism() && - (GetCompilerOptions().IsBootImage() || GetCompilerOptions().IsBootImageExtension())) { - // Resolve strings from const-string. Do this now to have a deterministic image. - ResolveConstStrings(dex_files, /*only_startup_strings=*/ false, timings); - VLOG(compiler) << "Resolve const-strings: " << GetMemoryUsageString(false); - } else if (GetCompilerOptions().ResolveStartupConstStrings()) { - ResolveConstStrings(dex_files, /*only_startup_strings=*/ true, timings); - } - - if (had_hard_verifier_failure_ && GetCompilerOptions().AbortOnHardVerifierFailure()) { - // Avoid dumping threads. Even if we shut down the thread pools, there will still be three - // instances of this thread's stack. - LOG(FATAL_WITHOUT_ABORT) << "Had a hard failure verifying all classes, and was asked to abort " - << "in such situations. Please check the log."; - _exit(1); - } else if (number_of_soft_verifier_failures_ > 0 && - GetCompilerOptions().AbortOnSoftVerifierFailure()) { - LOG(FATAL_WITHOUT_ABORT) << "Had " << number_of_soft_verifier_failures_ << " soft failure(s) " - << "verifying all classes, and was asked to abort in such situations. " - << "Please check the log."; - _exit(1); - } - } - - if (GetCompilerOptions().IsGeneratingImage()) { - // We can only initialize classes when their verification bit is set. - if (compiler_options_->AssumeClassesAreVerified() || - compiler_options_->IsVerificationEnabled()) { - if (kIsDebugBuild) { - EnsureVerifiedOrVerifyAtRuntime(class_loader, dex_files); - } - InitializeClasses(class_loader, dex_files, timings); - VLOG(compiler) << "InitializeClasses: " << GetMemoryUsageString(false); - } + } + + if (!compiler_options_->IsVerificationEnabled()) { + return; + } - UpdateImageClasses(timings, image_classes); - VLOG(compiler) << "UpdateImageClasses: " << GetMemoryUsageString(false); + Verify(class_loader, dex_files, timings, verification_results); + VLOG(compiler) << "Verify: " << GetMemoryUsageString(false); - if (kBitstringSubtypeCheckEnabled && - GetCompilerOptions().IsForceDeterminism() && GetCompilerOptions().IsBootImage()) { - // Initialize type check bit string used by check-cast and instanceof. - // Do this now to have a deterministic image. - // Note: This is done after UpdateImageClasses() at it relies on the image - // classes to be final. - InitializeTypeCheckBitstrings(this, dex_files, timings); + if (GetCompilerOptions().IsForceDeterminism() && + (GetCompilerOptions().IsBootImage() || GetCompilerOptions().IsBootImageExtension())) { + // Resolve strings from const-string. Do this now to have a deterministic image. + ResolveConstStrings(dex_files, /*only_startup_strings=*/ false, timings); + VLOG(compiler) << "Resolve const-strings: " << GetMemoryUsageString(false); + } else if (GetCompilerOptions().ResolveStartupConstStrings()) { + ResolveConstStrings(dex_files, /*only_startup_strings=*/ true, timings); + } + + if (had_hard_verifier_failure_ && GetCompilerOptions().AbortOnHardVerifierFailure()) { + // Avoid dumping threads. Even if we shut down the thread pools, there will still be three + // instances of this thread's stack. + LOG(FATAL_WITHOUT_ABORT) << "Had a hard failure verifying all classes, and was asked to abort " + << "in such situations. Please check the log."; + _exit(1); + } else if (number_of_soft_verifier_failures_ > 0 && + GetCompilerOptions().AbortOnSoftVerifierFailure()) { + LOG(FATAL_WITHOUT_ABORT) << "Had " << number_of_soft_verifier_failures_ << " soft failure(s) " + << "verifying all classes, and was asked to abort in such situations. " + << "Please check the log."; + _exit(1); + } + + if (compiler_options_->IsAnyCompilationEnabled()) { + if (kIsDebugBuild) { + EnsureVerifiedOrVerifyAtRuntime(class_loader, dex_files); } + InitializeClasses(class_loader, dex_files, timings); + VLOG(compiler) << "InitializeClasses: " << GetMemoryUsageString(false); + } + + UpdateImageClasses(timings, image_classes); + VLOG(compiler) << "UpdateImageClasses: " << GetMemoryUsageString(false); + + if (kBitstringSubtypeCheckEnabled && + GetCompilerOptions().IsForceDeterminism() && GetCompilerOptions().IsBootImage()) { + // Initialize type check bit string used by check-cast and instanceof. + // Do this now to have a deterministic image. + // Note: This is done after UpdateImageClasses() at it relies on the image classes to be final. + InitializeTypeCheckBitstrings(this, dex_files, timings); } } diff --git a/dex2oat/driver/compiler_driver_test.cc b/dex2oat/driver/compiler_driver_test.cc index 50cb292a4d..0a9702b330 100644 --- a/dex2oat/driver/compiler_driver_test.cc +++ b/dex2oat/driver/compiler_driver_test.cc @@ -308,7 +308,7 @@ class CompilerDriverVerifyTest : public CompilerDriverTest { bool found = compiler_driver_->GetCompiledClass( ClassReference(&klass->GetDexFile(), klass->GetDexTypeIndex().index_), &status); ASSERT_TRUE(found); - EXPECT_GE(status, ClassStatus::kVerified); + EXPECT_EQ(status, ClassStatus::kVerified); } }; |