diff options
author | 2018-05-24 15:19:52 +0100 | |
---|---|---|
committer | 2018-05-25 11:37:45 +0100 | |
commit | c7aa87e1666ac48ddf9149cfdfd64b026b3969e5 (patch) | |
tree | 32d5d74718cc558e13642873e55724782ac9df22 /runtime/art_method.cc | |
parent | 0278be74269fcfe4f2517d449f2bd53472f9b2f9 (diff) |
Remove static_class_ from Method/VarHandle and CallSite.
And add MethodHandle to the class roots to avoid extra
indirection through MethodHandleImpl.
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Bug: 31113334
Change-Id: Iaf172f3732677f2b4509e8297e6e9af5fb81a89f
Diffstat (limited to 'runtime/art_method.cc')
-rw-r--r-- | runtime/art_method.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/runtime/art_method.cc b/runtime/art_method.cc index 608e33cf65..151c36f3bc 100644 --- a/runtime/art_method.cc +++ b/runtime/art_method.cc @@ -24,6 +24,7 @@ #include "art_method-inl.h" #include "base/stringpiece.h" #include "class_linker-inl.h" +#include "class_root.h" #include "debugger.h" #include "dex/descriptors_names.h" #include "dex/dex_file-inl.h" @@ -47,7 +48,6 @@ #include "runtime_callbacks.h" #include "scoped_thread_state_change-inl.h" #include "vdex_file.h" -#include "well_known_classes.h" namespace art { @@ -68,7 +68,7 @@ ArtMethod* ArtMethod::GetCanonicalMethod(PointerSize pointer_size) { if (LIKELY(!IsDefault())) { return this; } else { - mirror::Class* declaring_class = GetDeclaringClass(); + ObjPtr<mirror::Class> declaring_class = GetDeclaringClass(); DCHECK(declaring_class->IsInterface()); ArtMethod* ret = declaring_class->FindInterfaceMethod(declaring_class->GetDexCache(), GetDexMethodIndex(), @@ -213,8 +213,8 @@ ArtMethod* ArtMethod::FindOverriddenMethod(PointerSize pointer_size) { if (IsStatic()) { return nullptr; } - mirror::Class* declaring_class = GetDeclaringClass(); - mirror::Class* super_class = declaring_class->GetSuperClass(); + ObjPtr<mirror::Class> declaring_class = GetDeclaringClass(); + ObjPtr<mirror::Class> super_class = declaring_class->GetSuperClass(); uint16_t method_index = GetMethodIndex(); ArtMethod* result = nullptr; // Did this method override a super class method? If so load the result from the super class' @@ -229,7 +229,7 @@ ArtMethod* ArtMethod::FindOverriddenMethod(PointerSize pointer_size) { } else { mirror::IfTable* iftable = GetDeclaringClass()->GetIfTable(); for (size_t i = 0; i < iftable->Count() && result == nullptr; i++) { - mirror::Class* interface = iftable->GetInterface(i); + ObjPtr<mirror::Class> interface = iftable->GetInterface(i); for (ArtMethod& interface_method : interface->GetVirtualMethods(pointer_size)) { if (HasSameNameAndSignature(interface_method.GetInterfaceMethodIfProxy(pointer_size))) { result = &interface_method; @@ -424,9 +424,11 @@ bool ArtMethod::IsPolymorphicSignature() { if (!IsNative() || !IsVarargs()) { return false; } - mirror::Class* cls = GetDeclaringClass(); - return (cls == WellKnownClasses::ToClass(WellKnownClasses::java_lang_invoke_MethodHandle) || - cls == WellKnownClasses::ToClass(WellKnownClasses::java_lang_invoke_VarHandle)); + ObjPtr<mirror::ObjectArray<mirror::Class>> class_roots = + Runtime::Current()->GetClassLinker()->GetClassRoots(); + ObjPtr<mirror::Class> cls = GetDeclaringClass(); + return (cls == GetClassRoot<mirror::MethodHandle>(class_roots) || + cls == GetClassRoot<mirror::VarHandle>(class_roots)); } static uint32_t GetOatMethodIndexFromMethodIndex(const DexFile& dex_file, @@ -510,7 +512,7 @@ static const OatFile::OatMethod FindOatMethodFor(ArtMethod* method, } // Although we overwrite the trampoline of non-static methods, we may get here via the resolution // method for direct methods (or virtual methods made direct). - mirror::Class* declaring_class = method->GetDeclaringClass(); + ObjPtr<mirror::Class> declaring_class = method->GetDeclaringClass(); size_t oat_method_index; if (method->IsStatic() || method->IsDirect()) { // Simple case where the oat method index was stashed at load time. |