summaryrefslogtreecommitdiff
path: root/runtime/entrypoints/entrypoint_utils-inl.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2017-02-01 16:46:28 -0800
committer Andreas Gampe <agampe@google.com> 2017-04-21 08:40:33 -0700
commitc6ea7d00ad069a2736f603daa3d8eaa9a1f8ea11 (patch)
treea6d3332a8592fb806841314d55b206b573d37d86 /runtime/entrypoints/entrypoint_utils-inl.h
parentd68677c5fde1ace16ea58d65733776c954e7acb4 (diff)
ART: Clean up art_method.h
Clean up the header. Fix up other headers including the -inl file, in an effort to prune the include graph. Fix broken transitive includes by making includes explicit. Introduce new -inl files for method handles and reference visiting. Test: source build/envsetup.sh && lunch aosp_angler-userdebug && mmma art Test: source build/envsetup.sh && lunch aosp_mips64-userdebug && mmma art Change-Id: I8f60f1160c2a702fdf3598149dae38f6fa6bc851
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils-inl.h')
-rw-r--r--runtime/entrypoints/entrypoint_utils-inl.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index ba8cec3a52..caf2e5dfee 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -779,9 +779,32 @@ inline mirror::Class* ResolveVerifyAndClinit(dex::TypeIndex type_idx,
return h_class.Get();
}
+static inline mirror::String* ResolveString(ClassLinker* class_linker,
+ dex::StringIndex string_idx,
+ ArtMethod* referrer)
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ Thread::PoisonObjectPointersIfDebug();
+ ObjPtr<mirror::String> string = referrer->GetDexCache()->GetResolvedString(string_idx);
+ if (UNLIKELY(string == nullptr)) {
+ StackHandleScope<1> hs(Thread::Current());
+ Handle<mirror::DexCache> dex_cache(hs.NewHandle(referrer->GetDexCache()));
+ const DexFile& dex_file = *dex_cache->GetDexFile();
+ string = class_linker->ResolveString(dex_file, string_idx, dex_cache);
+ }
+ return string.Ptr();
+}
+
inline mirror::String* ResolveStringFromCode(ArtMethod* referrer, dex::StringIndex string_idx) {
- ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
- return class_linker->ResolveString(string_idx, referrer);
+ Thread::PoisonObjectPointersIfDebug();
+ ObjPtr<mirror::String> string = referrer->GetDexCache()->GetResolvedString(string_idx);
+ if (UNLIKELY(string == nullptr)) {
+ StackHandleScope<1> hs(Thread::Current());
+ Handle<mirror::DexCache> dex_cache(hs.NewHandle(referrer->GetDexCache()));
+ const DexFile& dex_file = *dex_cache->GetDexFile();
+ ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
+ string = class_linker->ResolveString(dex_file, string_idx, dex_cache);
+ }
+ return string.Ptr();
}
inline void UnlockJniSynchronizedMethod(jobject locked, Thread* self) {