diff options
| author | 2017-01-28 00:51:55 +0000 | |
|---|---|---|
| committer | 2017-01-28 00:51:56 +0000 | |
| commit | 27d829a10c9fabcf7241f21029a5709fd15fc04f (patch) | |
| tree | 8880ce99166b4fccf1ef7321ab5d0c5d24a57d6e /runtime/runtime.cc | |
| parent | dbdd53535231009242c50217a0e01512e8981c04 (diff) | |
| parent | 1ee6dd71e1b9e51e15aae4d3bc95d799f11dbd04 (diff) | |
Merge "ART: Give JIT thread pool workers a peer"
Diffstat (limited to 'runtime/runtime.cc')
| -rw-r--r-- | runtime/runtime.cc | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc index b30e5109b6..0ea42960dd 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -672,24 +672,6 @@ 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()); @@ -714,6 +696,27 @@ 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. { |