diff options
author | Andreas Gampe <agampe@google.com> | 2017-01-30 16:40:49 +0000 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2017-02-09 12:09:03 -0800 |
commit | f9e3754e8a2f6244e037362c03db32d4244ecb2d (patch) | |
tree | 0524f55012a7defa887c0676a2a1a3eabbe3681a | |
parent | 2db6c407e948941cead24e4fc0907716ffcd45a1 (diff) | |
download | art-nougat-mr2.1-release.tar.gz |
Revert "Revert "ART: Give JIT thread pool workers a peer""android-7.1.2_r9android-7.1.2_r8android-7.1.2_r6android-7.1.2_r5android-7.1.2_r4android-7.1.2_r36android-7.1.2_r33android-7.1.2_r32android-7.1.2_r30android-7.1.2_r3android-7.1.2_r29android-7.1.2_r28android-7.1.2_r27android-7.1.2_r25android-7.1.2_r24android-7.1.2_r23android-7.1.2_r2android-7.1.2_r19android-7.1.2_r18android-7.1.2_r17android-7.1.2_r16android-7.1.2_r15android-7.1.2_r14android-7.1.2_r13android-7.1.2_r12android-7.1.2_r11android-7.1.2_r10android-7.1.2_r1nougat-mr2.3-releasenougat-mr2.2-releasenougat-mr2.1-releasenougat-mr2-releasenougat-mr2-pixel-releasenougat-mr2-dev
This reverts commit 9dfb707ba2f8c2ff67d42c26e3214f5d7142b6d3.
Accept a live Java thread for the JIT, and adjust the tests
accordingly.
(cherry picked from commit 4471e4f7c5874bdaf93762b6047d4a4bebc465df)
Bug: 31684920
Test: m ART_TEST_JIT=true ART_TEST_INTERPRETER=true test-art-host
Change-Id: I92cbae1eaae05711b9069335cf1a5f7eb58b9fd8
-rw-r--r-- | runtime/jit/jit.cc | 13 | ||||
-rw-r--r-- | runtime/runtime.cc | 39 |
2 files changed, 32 insertions, 20 deletions
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 74d99176c4..8cd867d0ba 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -145,7 +145,12 @@ Jit::Jit() : dump_info_on_shutdown_(false), memory_use_("Memory used for compilation", 16), lock_("JIT memory use lock"), use_jit_compilation_(true), - save_profiling_info_(false) {} + save_profiling_info_(false), + hot_method_threshold_(0), + warm_method_threshold_(0), + osr_method_threshold_(0), + priority_thread_weight_(0), + invoke_transition_weight_(0) {} Jit* Jit::Create(JitOptions* options, std::string* error_msg) { DCHECK(options->UseJitCompilation() || options->GetSaveProfilingInfo()); @@ -280,7 +285,11 @@ 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. - thread_pool_.reset(new ThreadPool("Jit thread pool", 1)); + + // 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_->SetPthreadPriority(kJitPoolThreadPthreadPriority); thread_pool_->StartWorkers(Thread::Current()); } diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 4300cd23ff..6d0d6ed7fc 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -583,24 +583,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()); @@ -625,6 +607,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; + } + } + } + system_class_loader_ = CreateSystemClassLoader(this); if (is_zygote_) { |