// Handles string resolution for const-string and const-string-jumbo instructions. Also ensures the
// java.lang.String class is initialized.
-static inline String* ResolveString(Thread* self, MethodHelper& mh, uint32_t string_idx)
+static inline String* ResolveString(Thread* self, ShadowFrame& shadow_frame, uint32_t string_idx)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
CHECK(!kMovingMethods);
Class* java_lang_string_class = String::GetJavaLangString();
return nullptr;
}
}
- return mh.ResolveString(string_idx);
+ mirror::ArtMethod* method = shadow_frame.GetMethod();
+ mirror::String* s = method->GetDexCacheStrings()->Get(string_idx);
+ if (UNLIKELY(s == nullptr)) {
+ StackHandleScope<1> hs(self);
+ Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache()));
+ s = Runtime::Current()->GetClassLinker()->ResolveString(*method->GetDexFile(), string_idx,
+ dex_cache);
+ }
+ return s;
}
// Handles div-int, div-int/2addr, div-int/li16 and div-int/lit8 instructions.
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(CONST_STRING) {
- String* s = ResolveString(self, mh, inst->VRegB_21c());
+ String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
if (UNLIKELY(s == NULL)) {
HANDLE_PENDING_EXCEPTION();
} else {
HANDLE_INSTRUCTION_END();
HANDLE_INSTRUCTION_START(CONST_STRING_JUMBO) {
- String* s = ResolveString(self, mh, inst->VRegB_31c());
+ String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
if (UNLIKELY(s == NULL)) {
HANDLE_PENDING_EXCEPTION();
} else {
break;
case Instruction::CONST_STRING: {
PREAMBLE();
- String* s = ResolveString(self, mh, inst->VRegB_21c());
+ String* s = ResolveString(self, shadow_frame, inst->VRegB_21c());
if (UNLIKELY(s == NULL)) {
HANDLE_PENDING_EXCEPTION();
} else {
}
case Instruction::CONST_STRING_JUMBO: {
PREAMBLE();
- String* s = ResolveString(self, mh, inst->VRegB_31c());
+ String* s = ResolveString(self, shadow_frame, inst->VRegB_31c());
if (UNLIKELY(s == NULL)) {
HANDLE_PENDING_EXCEPTION();
} else {
return GetClassFromTypeIdx(return_type_idx, resolve);
}
-template <template <class T> class HandleKind>
-inline mirror::String* MethodHelperT<HandleKind>::ResolveString(uint32_t string_idx) {
- mirror::ArtMethod* method = GetMethod();
- mirror::String* s = method->GetDexCacheStrings()->Get(string_idx);
- if (UNLIKELY(s == nullptr)) {
- StackHandleScope<1> hs(Thread::Current());
- Handle<mirror::DexCache> dex_cache(hs.NewHandle(method->GetDexCache()));
- s = Runtime::Current()->GetClassLinker()->ResolveString(*method->GetDexFile(), string_idx,
- dex_cache);
- }
- return s;
-}
-
} // namespace art
#endif // ART_RUNTIME_METHOD_HELPER_INL_H_
mirror::Class* GetClassFromTypeIdx(uint16_t type_idx, bool resolve = true)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- mirror::String* ResolveString(uint32_t string_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
-
uint32_t FindDexMethodIndexInOtherDexFile(const DexFile& other_dexfile)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);