diff options
Diffstat (limited to 'dex2oat/dex2oat.cc')
| -rw-r--r-- | dex2oat/dex2oat.cc | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 7d4b726292..cd78df1912 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -165,7 +165,13 @@ static void UsageError(const char* fmt, ...) { UsageError(" --compiler-backend=(Quick|Optimizing|Portable): select compiler backend"); UsageError(" set."); UsageError(" Example: --compiler-backend=Portable"); - UsageError(" Default: Quick"); + if (kUsePortableCompiler) { + UsageError(" Default: Portable"); + } else if (kUseOptimizingCompiler) { + UsageError(" Default: Optimizing"); + } else { + UsageError(" Default: Quick"); + } UsageError(""); UsageError(" --compiler-filter=" "(verify-none" @@ -419,7 +425,9 @@ static void ParseDouble(const std::string& option, char after_char, double min, class Dex2Oat FINAL { public: explicit Dex2Oat(TimingLogger* timings) : - compiler_kind_(kUsePortableCompiler ? Compiler::kPortable : Compiler::kQuick), + compiler_kind_(kUsePortableCompiler + ? Compiler::kPortable + : (kUseOptimizingCompiler ? Compiler::kOptimizing : Compiler::kQuick)), instruction_set_(kRuntimeISA), // Take the default set of instruction features from the build. method_inliner_map_(), @@ -597,7 +605,6 @@ class Dex2Oat FINAL { compiler_kind_ = Compiler::kQuick; } else if (backend_str == "Optimizing") { compiler_kind_ = Compiler::kOptimizing; - compile_pic = true; } else if (backend_str == "Portable") { compiler_kind_ = Compiler::kPortable; } else { @@ -702,11 +709,26 @@ class Dex2Oat FINAL { // on having verbost methods. gLogVerbosity.compiler = false; Split(option.substr(strlen("--verbose-methods=")).ToString(), ',', &verbose_methods_); + } else if (option.starts_with("--dump-init-failures=")) { + std::string file_name = option.substr(strlen("--dump-init-failures=")).data(); + init_failure_output_.reset(new std::ofstream(file_name)); + if (init_failure_output_.get() == nullptr) { + LOG(ERROR) << "Failed to allocate ofstream"; + } else if (init_failure_output_->fail()) { + LOG(ERROR) << "Failed to open " << file_name << " for writing the initialization " + << "failures."; + init_failure_output_.reset(); + } } else { Usage("Unknown argument %s", option.data()); } } + if (compiler_kind_ == Compiler::kOptimizing) { + // Optimizing only supports PIC mode. + compile_pic = true; + } + if (oat_filename_.empty() && oat_fd_ == -1) { Usage("Output must be supplied with either --oat-file or --oat-fd"); } @@ -906,7 +928,8 @@ class Dex2Oat FINAL { #endif verbose_methods_.empty() ? nullptr : - &verbose_methods_)); + &verbose_methods_, + init_failure_output_.get())); // Done with usage checks, enable watchdog if requested if (watch_dog_enabled) { @@ -1640,6 +1663,7 @@ class Dex2Oat FINAL { std::string profile_file_; // Profile file to use TimingLogger* timings_; std::unique_ptr<CumulativeLogger> compiler_phases_timings_; + std::unique_ptr<std::ostream> init_failure_output_; DISALLOW_IMPLICIT_CONSTRUCTORS(Dex2Oat); }; |