diff options
| author | 2017-07-17 20:01:29 +0000 | |
|---|---|---|
| committer | 2017-07-17 20:01:29 +0000 | |
| commit | 32df620576743b119a266cbc6afe7efecc80e97f (patch) | |
| tree | d7f849a727e1188758cee1a72c566894b15fe4ff /compiler/driver/compiler_driver.cc | |
| parent | 5fde01a13f5000d16fc8f5b96aa0d2f3623d1961 (diff) | |
| parent | 88b74b6a4dbbe0b5b75ef1738833e5b064e85d4c (diff) | |
Merge "Avoid creating compiled_methods_ array unnecessarily"
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
| -rw-r--r-- | compiler/driver/compiler_driver.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index bb64755c9e..c04e45d334 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -890,17 +890,18 @@ void CompilerDriver::PreCompile(jobject class_loader, TimingLogger* timings) { CheckThreadPools(); - for (const DexFile* dex_file : dex_files) { - // Can be already inserted if the caller is CompileOne. This happens for gtests. - if (!compiled_methods_.HaveDexFile(dex_file)) { - compiled_methods_.AddDexFile(dex_file); - } - } - LoadImageClasses(timings); VLOG(compiler) << "LoadImageClasses: " << GetMemoryUsageString(false); if (compiler_options_->IsAnyCompilationEnabled()) { + // Avoid adding the dex files in the case where we aren't going to add compiled methods. + // This reduces RAM usage for this case. + for (const DexFile* dex_file : dex_files) { + // Can be already inserted if the caller is CompileOne. This happens for gtests. + if (!compiled_methods_.HaveDexFile(dex_file)) { + compiled_methods_.AddDexFile(dex_file); + } + } // Resolve eagerly to prepare for compilation. Resolve(class_loader, dex_files, timings); VLOG(compiler) << "Resolve: " << GetMemoryUsageString(false); |