Move debugger.cc GetCanonicalMethod to ArtMethod
This functionality will be useful to other parts of the runtime so put
it in a more central place.
Test: ./test.py --host -j40
Change-Id: I4d19cc1016884f5921245ac284c7323cbf3ea8cd
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index 1554986..3e7ed97 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -61,6 +61,19 @@
static_assert(ArtMethod::kRuntimeMethodDexMethodIndex == DexFile::kDexNoIndex,
"Wrong runtime-method dex method index");
+ArtMethod* ArtMethod::GetCanonicalMethod(PointerSize pointer_size) {
+ if (LIKELY(!IsDefault())) {
+ return this;
+ } else {
+ mirror::Class* declaring_class = GetDeclaringClass();
+ ArtMethod* ret = declaring_class->FindDeclaredVirtualMethod(declaring_class->GetDexCache(),
+ GetDexMethodIndex(),
+ pointer_size);
+ DCHECK(ret != nullptr);
+ return ret;
+ }
+}
+
ArtMethod* ArtMethod::GetNonObsoleteMethod() {
DCHECK_EQ(kRuntimePointerSize, Runtime::Current()->GetClassLinker()->GetImagePointerSize());
if (LIKELY(!IsObsolete())) {