From: Andreas Gampe Date: Sat, 28 Jan 2017 02:35:31 +0000 (+0000) Subject: Revert "ART: Give JIT thread pool workers a peer" X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=9dfb707ba2f8c2ff67d42c26e3214f5d7142b6d3;p=android-x86%2Fart.git Revert "ART: Give JIT thread pool workers a peer" This reverts commit 1ee6dd71e1b9e51e15aae4d3bc95d799f11dbd04. Has unintended consequences that need to be discussed. Bug: 31684920 Change-Id: If0ff1b5d7473f98cb3a0efc3b4bb2c0f96ad684d --- diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index fec3c4f7b..6deb03dc4 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -145,12 +145,7 @@ Jit::Jit() : dump_info_on_shutdown_(false), cumulative_timings_("JIT timings"), memory_use_("Memory used for compilation", 16), lock_("JIT memory use lock"), - use_jit_compilation_(true), - hot_method_threshold_(0), - warm_method_threshold_(0), - osr_method_threshold_(0), - priority_thread_weight_(0), - invoke_transition_weight_(0) {} + use_jit_compilation_(true) {} Jit* Jit::Create(JitOptions* options, std::string* error_msg) { DCHECK(options->UseJitCompilation() || options->GetProfileSaverOptions().IsEnabled()); @@ -294,11 +289,7 @@ bool Jit::CompileMethod(ArtMethod* method, Thread* self, bool osr) { void Jit::CreateThreadPool() { // There is a DCHECK in the 'AddSamples' method to ensure the tread pool // is not null when we instrument. - - // We need peers as we may report the JIT thread, e.g., in the debugger. - constexpr bool kJitPoolNeedsPeers = true; - thread_pool_.reset(new ThreadPool("Jit thread pool", 1, kJitPoolNeedsPeers)); - + thread_pool_.reset(new ThreadPool("Jit thread pool", 1)); thread_pool_->SetPthreadPriority(kJitPoolThreadPthreadPriority); Start(); } diff --git a/runtime/runtime.cc b/runtime/runtime.cc index b079349d3..5e008a8bb 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -671,6 +671,24 @@ bool Runtime::Start() { started_ = true; + // Create the JIT either if we have to use JIT compilation or save profiling info. + // TODO(calin): We use the JIT class as a proxy for JIT compilation and for + // recoding profiles. Maybe we should consider changing the name to be more clear it's + // not only about compiling. b/28295073. + if (jit_options_->UseJitCompilation() || jit_options_->GetSaveProfilingInfo()) { + std::string error_msg; + if (!IsZygote()) { + // If we are the zygote then we need to wait until after forking to create the code cache + // due to SELinux restrictions on r/w/x memory regions. + CreateJit(); + } else if (jit_options_->UseJitCompilation()) { + if (!jit::Jit::LoadCompilerLibrary(&error_msg)) { + // Try to load compiler pre zygote to reduce PSS. b/27744947 + LOG(WARNING) << "Failed to load JIT compiler with error " << error_msg; + } + } + } + if (!IsImageDex2OatEnabled() || !GetHeap()->HasBootImageSpace()) { ScopedObjectAccess soa(self); StackHandleScope<2> hs(soa.Self()); @@ -695,27 +713,6 @@ bool Runtime::Start() { Thread::FinishStartup(); - // Create the JIT either if we have to use JIT compilation or save profiling info. This is - // done after FinishStartup as the JIT pool needs Java thread peers, which require the main - // ThreadGroup to exist. - // - // TODO(calin): We use the JIT class as a proxy for JIT compilation and for - // recoding profiles. Maybe we should consider changing the name to be more clear it's - // not only about compiling. b/28295073. - if (jit_options_->UseJitCompilation() || jit_options_->GetSaveProfilingInfo()) { - std::string error_msg; - if (!IsZygote()) { - // If we are the zygote then we need to wait until after forking to create the code cache - // due to SELinux restrictions on r/w/x memory regions. - CreateJit(); - } else if (jit_options_->UseJitCompilation()) { - if (!jit::Jit::LoadCompilerLibrary(&error_msg)) { - // Try to load compiler pre zygote to reduce PSS. b/27744947 - LOG(WARNING) << "Failed to load JIT compiler with error " << error_msg; - } - } - } - // Send the start phase event. We have to wait till here as this is when the main thread peer // has just been generated, important root clinits have been run and JNI is completely functional. {