From fd37f1dafbc1c9763b8ea30855120d2c22062732 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 12 Jun 2017 22:15:09 +0000 Subject: Revert "Revert "Fixed installation time regression when compile."" Bug: 62337922 This reverts commit 54c32b1f3362129d79e512581d4932aec92425eb. Change-Id: Ica942c9e70b63e2c4893f87c15757a519a0c4d73 --- compiler/driver/compiler_driver.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 0097f55e53..93f678c64a 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -2292,9 +2292,18 @@ class InitializeClassVisitor : public CompilationVisitor { ObjectLock lock(soa.Self(), h_klass); // Attempt to initialize allowing initialization of parent classes but still not static // fields. - bool is_superclass_initialized = InitializeDependencies(klass, class_loader, soa.Self()); - if (is_superclass_initialized) { + bool is_superclass_initialized = true; + if (!manager_->GetCompiler()->GetCompilerOptions().IsAppImage()) { + // If not an app image case, the compiler won't initialize too much things and do a fast + // fail, don't check dependencies. manager_->GetClassLinker()->EnsureInitialized(soa.Self(), klass, false, true); + } else { + // For app images, do the initialization recursively and resolve types encountered to make + // sure the compiler runs without error. + is_superclass_initialized = InitializeDependencies(klass, class_loader, soa.Self()); + if (is_superclass_initialized) { + manager_->GetClassLinker()->EnsureInitialized(soa.Self(), klass, false, true); + } } old_status = klass->GetStatus(); // If superclass cannot be initialized, no need to proceed. -- cgit v1.2.3-59-g8ed1b