diff options
author | 2021-12-01 17:53:14 +0000 | |
---|---|---|
committer | 2021-12-02 12:05:10 +0000 | |
commit | 80f93a801329abce10971b0db2da1103023abbaa (patch) | |
tree | ebc59b86afa7d90a4c049894283462ad4470790f | |
parent | 884731c88e622e862634daec445c39d89519d62b (diff) |
Make the baseline threshold based on -Xjitthreshold.
Also remove handling of now unused -Xjitosrtreshold.
Test: test.py
Change-Id: Ib808373c58cacede2a8fa71ea6c69a4456cedbb5
-rw-r--r-- | runtime/interpreter/mterp/nterp.cc | 2 | ||||
-rw-r--r-- | runtime/interpreter/mterp/nterp.h | 4 | ||||
-rw-r--r-- | runtime/jit/jit.cc | 7 | ||||
-rw-r--r-- | runtime/jit/jit.h | 10 | ||||
-rw-r--r-- | runtime/jit/profiling_info.cc | 6 | ||||
-rw-r--r-- | runtime/jit/profiling_info.h | 6 | ||||
-rw-r--r-- | runtime/parsed_options.cc | 5 | ||||
-rw-r--r-- | runtime/runtime_options.def | 1 |
8 files changed, 10 insertions, 31 deletions
diff --git a/runtime/interpreter/mterp/nterp.cc b/runtime/interpreter/mterp/nterp.cc index 009f9bc2d9..670ae1b0c2 100644 --- a/runtime/interpreter/mterp/nterp.cc +++ b/runtime/interpreter/mterp/nterp.cc @@ -81,8 +81,6 @@ void CheckNterpAsmConstants() { LOG(FATAL) << "ERROR: unexpected asm interp size " << interp_size << "(did an instruction handler exceed " << width << " bytes?)"; } - static_assert(IsPowerOfTwo(kTieredHotnessMask + 1), - "Tiered hotness mask must be a (power of 2) - 1"); } inline void UpdateHotness(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_) { diff --git a/runtime/interpreter/mterp/nterp.h b/runtime/interpreter/mterp/nterp.h index b7cbbf7cde..1590b280e9 100644 --- a/runtime/interpreter/mterp/nterp.h +++ b/runtime/interpreter/mterp/nterp.h @@ -35,10 +35,6 @@ const void* GetNterpEntryPoint(); constexpr uint16_t kNterpHotnessValue = 0; -// The hotness threshold for the baseline compiler to trigger optimized -// compilation. -constexpr uint16_t kTieredHotnessMask = 0xffff; - // The maximum we allow an nterp frame to be. constexpr size_t kNterpMaxFrame = 3 * KB; diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 9c5eff5282..2ab10ff0f8 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -129,13 +129,6 @@ JitOptions* JitOptions::CreateFromRuntimeArguments(const RuntimeArgumentMap& opt } DCHECK_LE(jit_options->warmup_threshold_, kJitMaxThreshold); - if (options.Exists(RuntimeArgumentMap::JITOsrThreshold)) { - jit_options->osr_threshold_ = *options.Get(RuntimeArgumentMap::JITOsrThreshold); - } else { - jit_options->osr_threshold_ = jit_options->warmup_threshold_; - } - DCHECK_LE(jit_options->osr_threshold_, kJitMaxThreshold); - if (options.Exists(RuntimeArgumentMap::JITPriorityThreadWeight)) { jit_options->priority_thread_weight_ = *options.Get(RuntimeArgumentMap::JITPriorityThreadWeight); diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h index 24dab6d66b..c0c4536783 100644 --- a/runtime/jit/jit.h +++ b/runtime/jit/jit.h @@ -78,10 +78,6 @@ class JitOptions { return warmup_threshold_; } - uint16_t GetOsrThreshold() const { - return osr_threshold_; - } - uint16_t GetPriorityThreadWeight() const { return priority_thread_weight_; } @@ -163,7 +159,6 @@ class JitOptions { size_t code_cache_max_capacity_; uint32_t optimize_threshold_; uint32_t warmup_threshold_; - uint32_t osr_threshold_; uint16_t priority_thread_weight_; uint16_t invoke_transition_weight_; bool dump_info_on_shutdown_; @@ -179,7 +174,6 @@ class JitOptions { code_cache_max_capacity_(0), optimize_threshold_(0), warmup_threshold_(0), - osr_threshold_(0), priority_thread_weight_(0), invoke_transition_weight_(0), dump_info_on_shutdown_(false), @@ -279,10 +273,6 @@ class Jit { return options_->GetThreadPoolPthreadPriority(); } - uint16_t OSRMethodThreshold() const { - return options_->GetOsrThreshold(); - } - uint16_t HotMethodThreshold() const { return options_->GetOptimizeThreshold(); } diff --git a/runtime/jit/profiling_info.cc b/runtime/jit/profiling_info.cc index b8e7303847..d859d5a467 100644 --- a/runtime/jit/profiling_info.cc +++ b/runtime/jit/profiling_info.cc @@ -26,7 +26,7 @@ namespace art { ProfilingInfo::ProfilingInfo(ArtMethod* method, const std::vector<uint32_t>& entries) - : baseline_hotness_count_(interpreter::kTieredHotnessMask), + : baseline_hotness_count_(GetOptimizeThreshold()), method_(method), number_of_inline_caches_(entries.size()), current_inline_uses_(0) { @@ -36,6 +36,10 @@ ProfilingInfo::ProfilingInfo(ArtMethod* method, const std::vector<uint32_t>& ent } } +uint16_t ProfilingInfo::GetOptimizeThreshold() { + return Runtime::Current()->GetJITOptions()->GetOptimizeThreshold(); +} + ProfilingInfo* ProfilingInfo::Create(Thread* self, ArtMethod* method) { // Walk over the dex instructions of the method and keep track of // instructions we are interested in profiling. diff --git a/runtime/jit/profiling_info.h b/runtime/jit/profiling_info.h index e6587173d4..ed0847c956 100644 --- a/runtime/jit/profiling_info.h +++ b/runtime/jit/profiling_info.h @@ -108,11 +108,11 @@ class ProfilingInfo { } void ResetCounter() { - baseline_hotness_count_ = interpreter::kTieredHotnessMask; + baseline_hotness_count_ = GetOptimizeThreshold(); } bool CounterHasChanged() const { - return baseline_hotness_count_ != interpreter::kTieredHotnessMask; + return baseline_hotness_count_ != GetOptimizeThreshold(); } uint16_t GetBaselineHotnessCount() const { @@ -122,6 +122,8 @@ class ProfilingInfo { private: ProfilingInfo(ArtMethod* method, const std::vector<uint32_t>& entries); + static uint16_t GetOptimizeThreshold(); + // Hotness count for methods compiled with the JIT baseline compiler. Once // a threshold is hit (currentily the maximum value of uint16_t), we will // JIT compile optimized the method. diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index a99995160b..7b108b5188 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -272,9 +272,6 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize .Define("-Xjitwarmupthreshold:_") .WithType<unsigned int>() .IntoKey(M::JITWarmupThreshold) - .Define("-Xjitosrthreshold:_") - .WithType<unsigned int>() - .IntoKey(M::JITOsrThreshold) .Define("-Xjitprithreadweight:_") .WithType<unsigned int>() .IntoKey(M::JITPriorityThreadWeight) @@ -475,7 +472,7 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize "-Xverifyopt:_", "-Xcheckdexsum", "-Xincludeselectedop", "-Xjitop:_", "-Xincludeselectedmethod", "-Xjitblocking", "-Xjitmethod:_", "-Xjitclass:_", "-Xjitoffset:_", - "-Xjitconfig:_", "-Xjitcheckcg", "-Xjitverbose", "-Xjitprofile", + "-Xjitosrthreshold:_", "-Xjitconfig:_", "-Xjitcheckcg", "-Xjitverbose", "-Xjitprofile", "-Xjitdisableopt", "-Xjitsuspendpoll", "-XX:mainThreadStackSize=_"}) .IgnoreUnrecognized(ignore_unrecognized) .OrderCategories({"standard", "extended", "Dalvik", "ART"}); diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def index b386d87cb2..5df8421f66 100644 --- a/runtime/runtime_options.def +++ b/runtime/runtime_options.def @@ -92,7 +92,6 @@ RUNTIME_OPTIONS_KEY (JniIdType, OpaqueJniIds, JniIdT RUNTIME_OPTIONS_KEY (bool, AutoPromoteOpaqueJniIds, true) // testing use only. -Xauto-promote-opaque-jni-ids:{true, false} RUNTIME_OPTIONS_KEY (unsigned int, JITOptimizeThreshold) RUNTIME_OPTIONS_KEY (unsigned int, JITWarmupThreshold) -RUNTIME_OPTIONS_KEY (unsigned int, JITOsrThreshold) RUNTIME_OPTIONS_KEY (unsigned int, JITPriorityThreadWeight) RUNTIME_OPTIONS_KEY (unsigned int, JITInvokeTransitionWeight) RUNTIME_OPTIONS_KEY (int, JITPoolThreadPthreadPriority, jit::kJitPoolThreadPthreadDefaultPriority) |