diff options
-rw-r--r-- | runtime/jit/jit.cc | 7 | ||||
-rw-r--r-- | runtime/jit/jit_code_cache.cc | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 25c747eed0..f8d51c6d8a 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -815,6 +815,13 @@ bool Jit::MaybeCompileMethod(Thread* self, } } if (UseJitCompilation()) { + if (old_count == 0 && + method->IsNative() && + Runtime::Current()->IsUsingApexBootImageLocation()) { + // jitzygote: Compile JNI stub on first use to avoid the expensive generic stub. + CompileMethod(method, self, /* baseline= */ false, /* osr= */ false); + return true; + } if (old_count < HotMethodThreshold() && new_count >= HotMethodThreshold()) { if (!code_cache_->ContainsPc(method->GetEntryPointFromQuickCompiledCode())) { DCHECK(thread_pool_ != nullptr); diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index c22f4e3d67..fee5becd75 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -2062,8 +2062,9 @@ bool JitCodeCache::NotifyCompilationOf(ArtMethod* method, Thread* self, bool osr } } if (collection_in_progress_) { - CHECK(!IsInZygoteExecSpace(data->GetCode())); - GetLiveBitmap()->AtomicTestAndSet(FromCodeToAllocation(data->GetCode())); + if (!IsInZygoteExecSpace(data->GetCode())) { + GetLiveBitmap()->AtomicTestAndSet(FromCodeToAllocation(data->GetCode())); + } } } return new_compilation; |