jitzygote: Also Pre-JIT native methods.
Those are not in the boot image profile, so just like AOT
make sure all native methods from the boot classpath get compiled.
Bug: 119800099
Test: app startup, no generic JNI used
Change-Id: Ie72971925918bfd560073affb31d4e563a6b616d
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index fa5cb92..c8db310 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3458,6 +3458,15 @@
DCHECK(class_linker->IsQuickGenericJniStub(entry_point) ||
class_linker->IsQuickResolutionStub(entry_point));
}
+
+ // For the jitzygote configuration we want JNI stubs to be compiled, just like boot classpath
+ // AOT where we compile all native entries.
+ if (!Runtime::Current()->IsUsingDefaultBootImageLocation() &&
+ method->GetDeclaringClass()->GetClassLoader() == nullptr &&
+ Runtime::Current()->GetJit() != nullptr) {
+ Runtime::Current()->GetJit()->CompileMethod(
+ method, Thread::Current(), /* baseline= */ false, /* osr= */ false);
+ }
}
}