diff options
| -rw-r--r-- | runtime/jit/jit.cc | 36 | ||||
| -rw-r--r-- | runtime/jit/jit.h | 3 | ||||
| -rw-r--r-- | runtime/parsed_options.cc | 5 | ||||
| -rw-r--r-- | runtime/runtime_options.def | 3 |
4 files changed, 37 insertions, 10 deletions
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 7dbd89cedb..5bd9a6b76b 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -41,20 +41,42 @@ static constexpr bool kEnableOnStackReplacement = true; JitOptions* JitOptions::CreateFromRuntimeArguments(const RuntimeArgumentMap& options) { auto* jit_options = new JitOptions; jit_options->use_jit_ = options.GetOrDefault(RuntimeArgumentMap::UseJIT); + jit_options->code_cache_initial_capacity_ = options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheInitialCapacity); jit_options->code_cache_max_capacity_ = options.GetOrDefault(RuntimeArgumentMap::JITCodeCacheMaxCapacity); - jit_options->compile_threshold_ = - options.GetOrDefault(RuntimeArgumentMap::JITCompileThreshold); - // TODO(ngeoffray): Make this a proper option. - jit_options->osr_threshold_ = jit_options->compile_threshold_ * 2; - jit_options->warmup_threshold_ = - options.GetOrDefault(RuntimeArgumentMap::JITWarmupThreshold); jit_options->dump_info_on_shutdown_ = options.Exists(RuntimeArgumentMap::DumpJITInfoOnShutdown); jit_options->save_profiling_info_ = - options.GetOrDefault(RuntimeArgumentMap::JITSaveProfilingInfo);; + options.GetOrDefault(RuntimeArgumentMap::JITSaveProfilingInfo); + + jit_options->compile_threshold_ = options.GetOrDefault(RuntimeArgumentMap::JITCompileThreshold); + if (jit_options->compile_threshold_ > std::numeric_limits<uint16_t>::max()) { + LOG(FATAL) << "Method compilation threshold is above its internal limit."; + } + + if (options.Exists(RuntimeArgumentMap::JITWarmupThreshold)) { + jit_options->warmup_threshold_ = *options.Get(RuntimeArgumentMap::JITWarmupThreshold); + if (jit_options->warmup_threshold_ > std::numeric_limits<uint16_t>::max()) { + LOG(FATAL) << "Method warmup threshold is above its internal limit."; + } + } else { + jit_options->warmup_threshold_ = jit_options->compile_threshold_ / 2; + } + + if (options.Exists(RuntimeArgumentMap::JITOsrThreshold)) { + jit_options->osr_threshold_ = *options.Get(RuntimeArgumentMap::JITOsrThreshold); + if (jit_options->osr_threshold_ > std::numeric_limits<uint16_t>::max()) { + LOG(FATAL) << "Method on stack replacement threshold is above its internal limit."; + } + } else { + jit_options->osr_threshold_ = jit_options->compile_threshold_ * 2; + if (jit_options->osr_threshold_ > std::numeric_limits<uint16_t>::max()) { + jit_options->osr_threshold_ = std::numeric_limits<uint16_t>::max(); + } + } + return jit_options; } diff --git a/runtime/jit/jit.h b/runtime/jit/jit.h index ee416d8772..d5c213416a 100644 --- a/runtime/jit/jit.h +++ b/runtime/jit/jit.h @@ -43,8 +43,7 @@ class JitOptions; class Jit { public: static constexpr bool kStressMode = kIsDebugBuild; - static constexpr size_t kDefaultCompileThreshold = kStressMode ? 2 : 500; - static constexpr size_t kDefaultWarmupThreshold = kDefaultCompileThreshold / 2; + static constexpr size_t kDefaultCompileThreshold = kStressMode ? 2 : 10000; virtual ~Jit(); static Jit* Create(JitOptions* options, std::string* error_msg); diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc index d64aa432fc..60403f9752 100644 --- a/runtime/parsed_options.cc +++ b/runtime/parsed_options.cc @@ -166,6 +166,9 @@ 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("-Xjitsaveprofilinginfo") .WithValue(true) .IntoKey(M::JITSaveProfilingInfo) @@ -694,6 +697,8 @@ void ParsedOptions::Usage(const char* fmt, ...) { UsageMessage(stream, " -Xusejit:booleanvalue\n"); UsageMessage(stream, " -Xjitinitialsize:N\n"); UsageMessage(stream, " -Xjitmaxsize:N\n"); + UsageMessage(stream, " -Xjitwarmupthreshold:integervalue\n"); + UsageMessage(stream, " -Xjitosrthreshold:integervalue\n"); UsageMessage(stream, " -X[no]relocate\n"); UsageMessage(stream, " -X[no]dex2oat (Whether to invoke dex2oat on the application)\n"); UsageMessage(stream, " -X[no]image-dex2oat (Whether to create and use a boot image)\n"); diff --git a/runtime/runtime_options.def b/runtime/runtime_options.def index 838d1a9649..3fd9905a60 100644 --- a/runtime/runtime_options.def +++ b/runtime/runtime_options.def @@ -69,7 +69,8 @@ RUNTIME_OPTIONS_KEY (bool, EnableHSpaceCompactForOOM, true) RUNTIME_OPTIONS_KEY (bool, UseJIT, false) RUNTIME_OPTIONS_KEY (bool, DumpNativeStackOnSigQuit, true) RUNTIME_OPTIONS_KEY (unsigned int, JITCompileThreshold, jit::Jit::kDefaultCompileThreshold) -RUNTIME_OPTIONS_KEY (unsigned int, JITWarmupThreshold, jit::Jit::kDefaultWarmupThreshold) +RUNTIME_OPTIONS_KEY (unsigned int, JITWarmupThreshold) +RUNTIME_OPTIONS_KEY (unsigned int, JITOsrThreshold) RUNTIME_OPTIONS_KEY (MemoryKiB, JITCodeCacheInitialCapacity, jit::JitCodeCache::kInitialCapacity) RUNTIME_OPTIONS_KEY (MemoryKiB, JITCodeCacheMaxCapacity, jit::JitCodeCache::kMaxCapacity) RUNTIME_OPTIONS_KEY (bool, JITSaveProfilingInfo, false) |