diff options
author | 2024-02-02 09:21:03 +0000 | |
---|---|---|
committer | 2024-02-06 12:35:32 +0000 | |
commit | 089c5fc39d68b5670e20733f13a0bb472c71e27f (patch) | |
tree | 5df757fa7caeac87bb9fa8263665484b4f89c990 /compiler | |
parent | 5592ceb65d8b33c1ebcd5e0b3f317a0c9f60f188 (diff) |
CompilerOptions refactor after aosp/2808063
* Updated comments
* Made constants constexpr
* Renamed kBaselineMaxCodeUnits to include "Inline"
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I37569b3d9e5eecfd65a505a79945bbe5b290fbbf
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/driver/compiler_options.h | 16 | ||||
-rw-r--r-- | compiler/optimizing/builder.cc | 4 | ||||
-rw-r--r-- | compiler/optimizing/inliner.cc | 2 |
3 files changed, 12 insertions, 10 deletions
diff --git a/compiler/driver/compiler_options.h b/compiler/driver/compiler_options.h index f659b12959..eaf9cc2fdb 100644 --- a/compiler/driver/compiler_options.h +++ b/compiler/driver/compiler_options.h @@ -60,14 +60,16 @@ enum class ProfileMethodsCheck : uint8_t { class CompilerOptions final { public: - // Guide heuristics to determine whether to compile method if profile data not available. - static const size_t kDefaultHugeMethodThreshold = 10000; - static const bool kDefaultGenerateDebugInfo = false; - static const bool kDefaultGenerateMiniDebugInfo = true; - static const size_t kDefaultInlineMaxCodeUnits = 32; - // We set a lower inlining threshold for baseline to reduce code size and compilation time. - static const size_t kBaselineMaxCodeUnits = 8; + // Default values for parameters set via flags. + static constexpr bool kDefaultGenerateDebugInfo = false; + static constexpr bool kDefaultGenerateMiniDebugInfo = true; + static constexpr size_t kDefaultHugeMethodThreshold = 10000; + static constexpr size_t kDefaultInlineMaxCodeUnits = 32; + // Token to represent no value set for `inline_max_code_units_`. static constexpr size_t kUnsetInlineMaxCodeUnits = -1; + // We set a lower inlining threshold for baseline to reduce code size and compilation time. This + // cannot be changed via flags. + static constexpr size_t kBaselineInlineMaxCodeUnits = 8; enum class CompilerType : uint8_t { kAotCompiler, // AOT compiler. diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 9233ea4fcd..1dea39626c 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -120,8 +120,8 @@ GraphAnalysisResult HGraphBuilder::BuildGraph() { return kAnalysisInvalidBytecode; } - // 2) Decide whether to skip this method based on its code size and number - // of branches. + // 2) Decide whether to skip compiling this method based on e.g. the compiler filter and method's + // code size. if (SkipCompilation()) { return kAnalysisSkipped; } diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 91f49c8ed8..fd3e787fc8 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -1553,7 +1553,7 @@ bool HInliner::IsInliningEncouraged(const HInvoke* invoke_instruction, } size_t inline_max_code_units = graph_->IsCompilingBaseline() - ? CompilerOptions::kBaselineMaxCodeUnits + ? CompilerOptions::kBaselineInlineMaxCodeUnits : codegen_->GetCompilerOptions().GetInlineMaxCodeUnits(); if (accessor.InsnsSizeInCodeUnits() > inline_max_code_units) { LOG_FAIL(stats_, MethodCompilationStat::kNotInlinedCodeItem) |