diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/driver/compiler_options.cc | 59 | ||||
-rw-r--r-- | compiler/driver/compiler_options.h | 34 | ||||
-rw-r--r-- | compiler/jit/jit_compiler.cc | 28 |
3 files changed, 17 insertions, 104 deletions
diff --git a/compiler/driver/compiler_options.cc b/compiler/driver/compiler_options.cc index a4e2083fe4..76f0ae9202 100644 --- a/compiler/driver/compiler_options.cc +++ b/compiler/driver/compiler_options.cc @@ -40,7 +40,7 @@ CompilerOptions::CompilerOptions() implicit_so_checks_(true), implicit_suspend_checks_(false), compile_pic_(false), - verbose_methods_(nullptr), + verbose_methods_(), abort_on_hard_verifier_failure_(false), init_failure_output_(nullptr), dump_cfg_file_name_(""), @@ -55,58 +55,6 @@ CompilerOptions::~CompilerOptions() { // because we don't want to include the PassManagerOptions definition from the header file. } -CompilerOptions::CompilerOptions(CompilerFilter::Filter compiler_filter, - size_t huge_method_threshold, - size_t large_method_threshold, - size_t small_method_threshold, - size_t tiny_method_threshold, - size_t num_dex_methods_threshold, - size_t inline_max_code_units, - const std::vector<const DexFile*>* no_inline_from, - double top_k_profile_threshold, - bool debuggable, - bool generate_debug_info, - bool implicit_null_checks, - bool implicit_so_checks, - bool implicit_suspend_checks, - bool compile_pic, - const std::vector<std::string>* verbose_methods, - std::ostream* init_failure_output, - bool abort_on_hard_verifier_failure, - const std::string& dump_cfg_file_name, - bool dump_cfg_append, - bool force_determinism, - RegisterAllocator::Strategy regalloc_strategy, - const std::vector<std::string>* passes_to_run) - : compiler_filter_(compiler_filter), - huge_method_threshold_(huge_method_threshold), - large_method_threshold_(large_method_threshold), - small_method_threshold_(small_method_threshold), - tiny_method_threshold_(tiny_method_threshold), - num_dex_methods_threshold_(num_dex_methods_threshold), - inline_max_code_units_(inline_max_code_units), - no_inline_from_(no_inline_from), - boot_image_(false), - app_image_(false), - top_k_profile_threshold_(top_k_profile_threshold), - debuggable_(debuggable), - generate_debug_info_(generate_debug_info), - generate_mini_debug_info_(kDefaultGenerateMiniDebugInfo), - generate_build_id_(false), - implicit_null_checks_(implicit_null_checks), - implicit_so_checks_(implicit_so_checks), - implicit_suspend_checks_(implicit_suspend_checks), - compile_pic_(compile_pic), - verbose_methods_(verbose_methods), - abort_on_hard_verifier_failure_(abort_on_hard_verifier_failure), - init_failure_output_(init_failure_output), - dump_cfg_file_name_(dump_cfg_file_name), - dump_cfg_append_(dump_cfg_append), - force_determinism_(force_determinism), - register_allocation_strategy_(regalloc_strategy), - passes_to_run_(passes_to_run) { -} - void CompilerOptions::ParseHugeMethodMax(const StringPiece& option, UsageFn Usage) { ParseUintOption(option, "--huge-method-max", &huge_method_threshold_, Usage); } @@ -204,6 +152,11 @@ bool CompilerOptions::ParseCompilerOption(const StringPiece& option, UsageFn Usa dump_cfg_append_ = true; } else if (option.starts_with("--register-allocation-strategy=")) { ParseRegisterAllocationStrategy(option, Usage); + } else if (option.starts_with("--verbose-methods=")) { + // TODO: rather than switch off compiler logging, make all VLOG(compiler) messages + // conditional on having verbose methods. + gLogVerbosity.compiler = false; + Split(option.substr(strlen("--verbose-methods=")).ToString(), ',', &verbose_methods_); } else { // Option not recognized. return false; diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index 89c2537476..b99263db0e 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -52,30 +52,6 @@ class CompilerOptions FINAL { CompilerOptions(); ~CompilerOptions(); - CompilerOptions(CompilerFilter::Filter compiler_filter, - size_t huge_method_threshold, - size_t large_method_threshold, - size_t small_method_threshold, - size_t tiny_method_threshold, - size_t num_dex_methods_threshold, - size_t inline_max_code_units, - const std::vector<const DexFile*>* no_inline_from, - double top_k_profile_threshold, - bool debuggable, - bool generate_debug_info, - bool implicit_null_checks, - bool implicit_so_checks, - bool implicit_suspend_checks, - bool compile_pic, - const std::vector<std::string>* verbose_methods, - std::ostream* init_failure_output, - bool abort_on_hard_verifier_failure, - const std::string& dump_cfg_file_name, - bool dump_cfg_append, - bool force_determinism, - RegisterAllocator::Strategy regalloc_strategy, - const std::vector<std::string>* passes_to_run); - CompilerFilter::Filter GetCompilerFilter() const { return compiler_filter_; } @@ -163,6 +139,10 @@ class CompilerOptions FINAL { return debuggable_; } + void SetDebuggable(bool value) { + debuggable_ = value; + } + bool GetNativeDebuggable() const { return GetDebuggable() && GetGenerateDebugInfo(); } @@ -211,11 +191,11 @@ class CompilerOptions FINAL { } bool HasVerboseMethods() const { - return verbose_methods_ != nullptr && !verbose_methods_->empty(); + return !verbose_methods_.empty(); } bool IsVerboseMethod(const std::string& pretty_method) const { - for (const std::string& cur_method : *verbose_methods_) { + for (const std::string& cur_method : verbose_methods_) { if (pretty_method.find(cur_method) != std::string::npos) { return true; } @@ -299,7 +279,7 @@ class CompilerOptions FINAL { bool compile_pic_; // Vector of methods to have verbose output enabled for. - const std::vector<std::string>* verbose_methods_; + std::vector<std::string> verbose_methods_; // Abort compilation with an error if we find a class that fails verification with a hard // failure. diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc index 66135414f7..715d97379e 100644 --- a/compiler/jit/jit_compiler.cc +++ b/compiler/jit/jit_compiler.cc @@ -90,36 +90,16 @@ NO_RETURN static void Usage(const char* fmt, ...) { } JitCompiler::JitCompiler() { - compiler_options_.reset(new CompilerOptions( - CompilerFilter::kDefaultCompilerFilter, - CompilerOptions::kDefaultHugeMethodThreshold, - CompilerOptions::kDefaultLargeMethodThreshold, - CompilerOptions::kDefaultSmallMethodThreshold, - CompilerOptions::kDefaultTinyMethodThreshold, - CompilerOptions::kDefaultNumDexMethodsThreshold, - CompilerOptions::kDefaultInlineMaxCodeUnits, - /* no_inline_from */ nullptr, - CompilerOptions::kDefaultTopKProfileThreshold, - Runtime::Current()->IsJavaDebuggable(), - CompilerOptions::kDefaultGenerateDebugInfo, - /* implicit_null_checks */ true, - /* implicit_so_checks */ true, - /* implicit_suspend_checks */ false, - /* pic */ false, - /* verbose_methods */ nullptr, - /* init_failure_output */ nullptr, - /* abort_on_hard_verifier_failure */ false, - /* dump_cfg_file_name */ "", - /* dump_cfg_append */ false, - /* force_determinism */ false, - RegisterAllocator::kRegisterAllocatorDefault, - /* passes_to_run */ nullptr)); + compiler_options_.reset(new CompilerOptions()); for (const std::string& argument : Runtime::Current()->GetCompilerOptions()) { compiler_options_->ParseCompilerOption(argument, Usage); } // JIT is never PIC, no matter what the runtime compiler options specify. compiler_options_->SetNonPic(); + // Set debuggability based on the runtime value. + compiler_options_->SetDebuggable(Runtime::Current()->IsJavaDebuggable()); + const InstructionSet instruction_set = kRuntimeISA; for (const StringPiece option : Runtime::Current()->GetCompilerOptions()) { VLOG(compiler) << "JIT compiler option " << option; |