summaryrefslogtreecommitdiff
path: root/runtime/mirror/class.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2015-12-15 22:15:34 +0000
committer Alex Light <allight@google.com> 2015-12-15 22:15:34 +0000
commit2efb0aa57da168944f99a2d13aed2a426cfa76e7 (patch)
tree5ca742f9a2a89f9c3c588f6f1863ab55bbdb5c5c /runtime/mirror/class.cc
parent9539150b85142c18e9e8c2264b5b6100942667c3 (diff)
Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"
This reverts commit 9539150b85142c18e9e8c2264b5b6100942667c3. Change-Id: I596876cd643ec0ad524a56621efb6b89e8886230
Diffstat (limited to 'runtime/mirror/class.cc')
-rw-r--r--runtime/mirror/class.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 66060f2221..05a9039ae9 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -457,10 +457,6 @@ ArtMethod* Class::FindDirectMethod(
return nullptr;
}
-// TODO These should maybe be changed to be named FindOwnedVirtualMethod or something similar
-// because they do not only find 'declared' methods and will return copied methods. This behavior is
-// desired and correct but the naming can lead to confusion because in the java language declared
-// excludes interface methods which might be found by this.
ArtMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature,
size_t pointer_size) {
for (auto& method : GetVirtualMethods(pointer_size)) {
@@ -486,8 +482,10 @@ ArtMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name, const Signa
ArtMethod* Class::FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx,
size_t pointer_size) {
if (GetDexCache() == dex_cache) {
- for (auto& method : GetDeclaredVirtualMethods(pointer_size)) {
- if (method.GetDexMethodIndex() == dex_method_idx) {
+ for (auto& method : GetVirtualMethods(pointer_size)) {
+ // A miranda method may have a different DexCache and is always created by linking,
+ // never *declared* in the class.
+ if (method.GetDexMethodIndex() == dex_method_idx && !method.IsMiranda()) {
return &method;
}
}
@@ -727,7 +725,12 @@ ArtField* Class::FindField(Thread* self, Handle<Class> klass, const StringPiece&
void Class::SetPreverifiedFlagOnAllMethods(size_t pointer_size) {
DCHECK(IsVerified());
- for (auto& m : GetMethods(pointer_size)) {
+ for (auto& m : GetDirectMethods(pointer_size)) {
+ if (!m.IsNative() && m.IsInvokable()) {
+ m.SetPreverified();
+ }
+ }
+ for (auto& m : GetVirtualMethods(pointer_size)) {
if (!m.IsNative() && m.IsInvokable()) {
m.SetPreverified();
}