Couple of improvements in the jit zygote pass.
- Handle the resolution stub.
- In verbose mode, log the time to JIT compile.
- Handle the case jit is disabled.
- Don't look at methods that are in the jars located in the runtime module.
Bug: 119800099
Test: m
Change-Id: Ib12586cc65b3791e066e96ce7e36985cfb612059
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index bbf3458..1957c82 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -197,7 +197,13 @@
{
TimingLogger::ScopedTiming t2("Compiling", &logger);
JitCodeCache* const code_cache = runtime->GetJit()->GetCodeCache();
+ uint64_t start_ns = NanoTime();
success = compiler_->JitCompile(self, code_cache, method, baseline, osr, jit_logger_.get());
+ uint64_t duration_ns = NanoTime() - start_ns;
+ VLOG(jit) << "Compilation of "
+ << method->PrettyMethod()
+ << " took "
+ << PrettyDuration(duration_ns);
}
// Trim maps to reduce memory usage.
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index bd60167..cbfc3a1 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -639,7 +639,7 @@
// If we're not using the default boot image location, request a JIT task to
// compile all methods in the boot image profile.
Runtime* runtime = Runtime::Current();
- if (runtime->IsZygote() && !runtime->IsUsingDefaultBootImageLocation()) {
+ if (runtime->IsZygote() && !runtime->IsUsingDefaultBootImageLocation() && UseJitCompilation()) {
thread_pool_->AddTask(Thread::Current(), new ZygoteTask());
}
}
@@ -683,6 +683,10 @@
ClassLinker* class_linker = runtime->GetClassLinker();
for (const DexFile* dex_file : boot_class_path) {
+ if (LocationIsOnRuntimeModule(dex_file->GetLocation().c_str())) {
+ // The runtime module jars are already preopted.
+ continue;
+ }
std::set<dex::TypeIndex> class_types;
std::set<uint16_t> all_methods;
if (!profile_info.GetClassesAndMethods(*dex_file,
@@ -690,7 +694,8 @@
&all_methods,
&all_methods,
&all_methods)) {
- LOG(ERROR) << "Unable to get classes and methods for " << dex_file->GetLocation();
+ // This means the profile file did not reference the dex file, which is the case
+ // if there's no classes and methods of that dex file in the profile.
continue;
}
dex_cache.Assign(class_linker->FindDexCache(self, *dex_file));
@@ -708,7 +713,8 @@
}
const void* entry_point = method->GetEntryPointFromQuickCompiledCode();
if (class_linker->IsQuickToInterpreterBridge(entry_point) ||
- class_linker->IsQuickGenericJniStub(entry_point)) {
+ class_linker->IsQuickGenericJniStub(entry_point) ||
+ class_linker->IsQuickResolutionStub(entry_point)) {
if (!method->IsNative()) {
// The compiler requires a ProfilingInfo object for non-native methods.
ProfilingInfo::Create(self, method, /* retry_allocation= */ true);