nterp: Don't compile baseline if a process cannot allocate profiling infos.
The zygote cannot allocate profiling infos. Found in b/148219586
Bug:148219586
Test: Use libartd on an x64 emulator
Test: gcar_emu_x86_64-userdebug boots.
Change-Id: Ic8c12c924dfc93498198a6619724f0015f674944
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 73b9f8b..d45b113 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -1760,9 +1760,14 @@
self, new JitCompileTask(method, JitCompileTask::TaskKind::kCompileOsr));
return;
}
- ProfilingInfo::Create(self, method, /* retry_allocation= */ false);
- thread_pool_->AddTask(
- self, new JitCompileTask(method, JitCompileTask::TaskKind::kCompileBaseline));
+ if (GetCodeCache()->CanAllocateProfilingInfo()) {
+ ProfilingInfo::Create(self, method, /* retry_allocation= */ false);
+ thread_pool_->AddTask(
+ self, new JitCompileTask(method, JitCompileTask::TaskKind::kCompileBaseline));
+ } else {
+ thread_pool_->AddTask(
+ self, new JitCompileTask(method, JitCompileTask::TaskKind::kCompile));
+ }
}
} // namespace jit