summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dex2oat/driver/compiler_driver.cc5
-rw-r--r--test/generate-boot-image/generate-boot-image.cc6
2 files changed, 7 insertions, 4 deletions
diff --git a/dex2oat/driver/compiler_driver.cc b/dex2oat/driver/compiler_driver.cc
index 3ad696b125..23bbe14efe 100644
--- a/dex2oat/driver/compiler_driver.cc
+++ b/dex2oat/driver/compiler_driver.cc
@@ -2179,13 +2179,16 @@ class InitializeClassVisitor : public CompilationVisitor {
bool too_many_encoded_fields = (!is_boot_image && !is_boot_image_extension) &&
klass->NumStaticFields() > kMaxEncodedFields;
+ bool have_profile = (compiler_options.GetProfileCompilationInfo() != nullptr) &&
+ !compiler_options.GetProfileCompilationInfo()->IsEmpty();
// If the class was not initialized, we can proceed to see if we can initialize static
// fields. Limit the max number of encoded fields.
if (!klass->IsInitialized() &&
(is_app_image || is_boot_image || is_boot_image_extension) &&
try_initialize_with_superclasses && !too_many_encoded_fields &&
compiler_options.IsImageClass(descriptor) &&
- compiler_options.IsAotCompilationEnabled()) {
+ // TODO(b/274077782): remove this test.
+ (have_profile || !is_boot_image_extension)) {
bool can_init_static_fields = false;
if (is_boot_image || is_boot_image_extension) {
// We need to initialize static fields, we only do this for image classes that aren't
diff --git a/test/generate-boot-image/generate-boot-image.cc b/test/generate-boot-image/generate-boot-image.cc
index f22bad4587..1b3eccf0e5 100644
--- a/test/generate-boot-image/generate-boot-image.cc
+++ b/test/generate-boot-image/generate-boot-image.cc
@@ -109,9 +109,9 @@ int main(int argc, char** argv) {
android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM));
std::string dir = "";
- // Set the compiler filter to `speed-profile` by default to make test preparation
- // faster and behave like normal boot image generation.
- std::string compiler_filter = "speed-profile";
+ // Set the compiler filter to `verify` by default to make test preparation
+ // faster.
+ std::string compiler_filter = "verify";
for (int i = 1; i < argc; i++) {
std::string_view arg{argv[i]};
if (android::base::ConsumePrefix(&arg, "--output-dir=")) {