summaryrefslogtreecommitdiff
path: root/runtime/class_linker.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/class_linker.h')
-rw-r--r--runtime/class_linker.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 5597149178..73b3153c45 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -41,6 +41,7 @@
#include "jni.h"
#include "mirror/class.h"
#include "mirror/object.h"
+#include "oat/jni_stub_hash_map.h"
#include "oat/oat_file.h"
#include "verifier/verifier_enums.h"
@@ -888,6 +889,17 @@ class EXPORT ClassLinker {
ClassTable* GetBootClassTable() REQUIRES_SHARED(Locks::classlinker_classes_lock_) {
return boot_class_table_.get();
}
+ // Find a matching JNI stub from boot images that we could reuse as entrypoint.
+ const void* FindBootJniStub(ArtMethod* method)
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ return FindBootJniStub(JniStubKey(method));
+ }
+
+ const void* FindBootJniStub(uint32_t flags, std::string_view shorty) {
+ return FindBootJniStub(JniStubKey(flags, shorty));
+ }
+
+ const void* FindBootJniStub(JniStubKey key);
protected:
virtual bool InitializeClass(Thread* self,
@@ -1410,6 +1422,10 @@ class EXPORT ClassLinker {
std::map<ArtMethod*, void*> critical_native_code_with_clinit_check_
GUARDED_BY(critical_native_code_with_clinit_check_lock_);
+ // Load unique JNI stubs from boot images. If the subsequently loaded native methods could find a
+ // matching stub, then reuse it without JIT/AOT compilation.
+ JniStubHashMap<const void*> boot_image_jni_stubs_;
+
std::unique_ptr<ClassHierarchyAnalysis> cha_;
class FindVirtualMethodHolderVisitor;