Move dex_files_for_oat_file_ to CompilerOptions.
A step toward removing the CompilerDriver dependency from
several classes, including HSharpening and ImageWriter.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Change-Id: I364ef66511fdf855cb11b12c818a40572b037727
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index ed4fb6f..66a8a57 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -885,8 +885,12 @@
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings) {
CheckThreadPools();
+
VLOG(compiler) << "Before precompile " << GetMemoryUsageString(false);
+ compiled_classes_.AddDexFiles(GetCompilerOptions().GetDexFilesForOatFile());
+ dex_to_dex_compiler_.SetDexFiles(GetCompilerOptions().GetDexFilesForOatFile());
+
// Precompile:
// 1) Load image classes.
// 2) Resolve all classes.
@@ -1948,7 +1952,8 @@
// Create per-thread VerifierDeps to avoid contention on the main one.
// We will merge them after verification.
for (ThreadPoolWorker* worker : parallel_thread_pool_->GetWorkers()) {
- worker->GetThread()->SetVerifierDeps(new verifier::VerifierDeps(dex_files_for_oat_file_));
+ worker->GetThread()->SetVerifierDeps(
+ new verifier::VerifierDeps(GetCompilerOptions().GetDexFilesForOatFile()));
}
}
@@ -1973,7 +1978,7 @@
for (ThreadPoolWorker* worker : parallel_thread_pool_->GetWorkers()) {
verifier::VerifierDeps* thread_deps = worker->GetThread()->GetVerifierDeps();
worker->GetThread()->SetVerifierDeps(nullptr);
- verifier_deps->MergeWith(*thread_deps, dex_files_for_oat_file_);
+ verifier_deps->MergeWith(*thread_deps, GetCompilerOptions().GetDexFilesForOatFile());
delete thread_deps;
}
Thread::Current()->SetVerifierDeps(nullptr);
@@ -2846,7 +2851,7 @@
if (kIsDebugBuild) {
// Check to make sure it's not a dex file for an oat file we are compiling since these
// should always succeed. These do not include classes in for used libraries.
- for (const DexFile* dex_file : GetDexFilesForOatFile()) {
+ for (const DexFile* dex_file : GetCompilerOptions().GetDexFilesForOatFile()) {
CHECK_NE(ref.dex_file, dex_file) << ref.dex_file->GetLocation();
}
}
@@ -2945,17 +2950,6 @@
return oss.str();
}
-bool CompilerDriver::MayInlineInternal(const DexFile* inlined_from,
- const DexFile* inlined_into) const {
- // We're not allowed to inline across dex files if we're the no-inline-from dex file.
- if (inlined_from != inlined_into &&
- ContainsElement(compiler_options_->GetNoInlineFromDexFile(), inlined_from)) {
- return false;
- }
-
- return true;
-}
-
void CompilerDriver::InitializeThreadPools() {
size_t parallel_count = parallel_thread_count_ > 0 ? parallel_thread_count_ - 1 : 0;
parallel_thread_pool_.reset(
@@ -2968,12 +2962,6 @@
single_thread_pool_.reset();
}
-void CompilerDriver::SetDexFilesForOatFile(const std::vector<const DexFile*>& dex_files) {
- dex_files_for_oat_file_ = dex_files;
- compiled_classes_.AddDexFiles(dex_files);
- dex_to_dex_compiler_.SetDexFiles(dex_files);
-}
-
void CompilerDriver::SetClasspathDexFiles(const std::vector<const DexFile*>& dex_files) {
classpath_classes_.AddDexFiles(dex_files);
}