Skip to content

Commit

Permalink
Couple of improvements in the jit zygote pass.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Nicolas Geoffray committed Apr 3, 2019
1 parent 30167d2 commit f59bc11
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions compiler/jit/jit_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ bool JitCompiler::CompileMethod(Thread* self, ArtMethod* method, bool baseline,
{
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.
Expand Down
12 changes: 9 additions & 3 deletions runtime/jit/jit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ void Jit::CreateThreadPool() {
// 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());
}
}
Expand Down Expand Up @@ -683,14 +683,19 @@ void Jit::AddNonAotBootMethodsToQueue(Thread* self) {
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,
&class_types,
&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));
Expand All @@ -708,7 +713,8 @@ void Jit::AddNonAotBootMethodsToQueue(Thread* self) {
}
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);
Expand Down

0 comments on commit f59bc11

Please sign in to comment.