Move explicit GC after we are done initalizing all classes.
Previously we had the GC happen for each dex file, this added a
few seconds of time on boot.oat creation.
Bug: 16853450
Change-Id: I6b78c8c6f6c3bc20c164d951f2af8efbff0b8600
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 1233a0d..af1fd88 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -1877,10 +1877,6 @@
thread_count = thread_count_;
}
context.ForAll(0, dex_file.NumClassDefs(), InitializeClass, thread_count);
- if (IsImage()) {
- // Prune garbage objects created during aborted transactions.
- Runtime::Current()->GetHeap()->CollectGarbage(true);
- }
}
void CompilerDriver::InitializeClasses(jobject class_loader,
@@ -1891,6 +1887,10 @@
CHECK(dex_file != NULL);
InitializeClasses(class_loader, *dex_file, dex_files, thread_pool, timings);
}
+ if (IsImage()) {
+ // Prune garbage objects created during aborted transactions.
+ Runtime::Current()->GetHeap()->CollectGarbage(true);
+ }
}
void CompilerDriver::Compile(jobject class_loader, const std::vector<const DexFile*>& dex_files,