Remove ResolveString from MethodHelper.
Change-Id: Ice0fff0680f876285539f78cd79d520d424e2f5e
diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h
index fa03fc7..6a0aaf2 100644
--- a/runtime/interpreter/interpreter_common.h
+++ b/runtime/interpreter/interpreter_common.h
@@ -187,7 +187,7 @@
// 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();
@@ -200,7 +200,15 @@
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.
diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc
index 88d6544..b970879 100644
--- a/runtime/interpreter/interpreter_goto_table_impl.cc
+++ b/runtime/interpreter/interpreter_goto_table_impl.cc
@@ -420,7 +420,7 @@
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 {
@@ -431,7 +431,7 @@
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 {
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index 14e8a52..1364ed2 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -331,7 +331,7 @@
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 {
@@ -342,7 +342,7 @@
}
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 {
diff --git a/runtime/method_helper-inl.h b/runtime/method_helper-inl.h
index 143f4bc..fca5cf7 100644
--- a/runtime/method_helper-inl.h
+++ b/runtime/method_helper-inl.h
@@ -67,19 +67,6 @@
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_
diff --git a/runtime/method_helper.h b/runtime/method_helper.h
index fe364d3..1458f88 100644
--- a/runtime/method_helper.h
+++ b/runtime/method_helper.h
@@ -115,8 +115,6 @@
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_);