diff options
| author | Vladimir Marko <vmarko@google.com> | 2018-05-24 15:19:52 +0100 |
|---|---|---|
| committer | Vladimir Marko <vmarko@google.com> | 2018-05-25 11:37:45 +0100 |
| commit | c7aa87e1666ac48ddf9149cfdfd64b026b3969e5 (patch) | |
| tree | 32d5d74718cc558e13642873e55724782ac9df22 /runtime/mirror/method_handle_impl.cc | |
| parent | 0278be74269fcfe4f2517d449f2bd53472f9b2f9 (diff) | |
| download | art-c7aa87e1666ac48ddf9149cfdfd64b026b3969e5.tar.gz art-c7aa87e1666ac48ddf9149cfdfd64b026b3969e5.tar.bz2 art-c7aa87e1666ac48ddf9149cfdfd64b026b3969e5.zip | |
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/mirror/method_handle_impl.cc')
| -rw-r--r-- | runtime/mirror/method_handle_impl.cc | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/runtime/mirror/method_handle_impl.cc b/runtime/mirror/method_handle_impl.cc index 0b4dde1aa8..a6c1609d01 100644 --- a/runtime/mirror/method_handle_impl.cc +++ b/runtime/mirror/method_handle_impl.cc @@ -17,6 +17,7 @@ #include "method_handle_impl-inl.h" #include "class-inl.h" +#include "class_root.h" #include "gc_root-inl.h" namespace art { @@ -30,12 +31,6 @@ const char* MethodHandle::GetReturnTypeDescriptor(const char* invoke_method_name } } -mirror::Class* MethodHandle::StaticClass() { - mirror::Class* klass = MethodHandleImpl::StaticClass()->GetSuperClass(); - DCHECK(klass->DescriptorEquals("Ljava/lang/invoke/MethodHandle;")); - return klass; -} - void MethodHandle::Initialize(uintptr_t art_field_or_method, Kind kind, Handle<MethodType> method_type) @@ -48,35 +43,14 @@ void MethodHandle::Initialize(uintptr_t art_field_or_method, SetField64<false>(ArtFieldOrMethodOffset(), art_field_or_method); } -GcRoot<mirror::Class> MethodHandleImpl::static_class_; - -mirror::Class* MethodHandleImpl::StaticClass() { - return static_class_.Read(); -} - -void MethodHandleImpl::SetClass(Class* klass) { - CHECK(static_class_.IsNull()) << static_class_.Read() << " " << klass; - CHECK(klass != nullptr); - static_class_ = GcRoot<Class>(klass); -} - -void MethodHandleImpl::ResetClass() { - CHECK(!static_class_.IsNull()); - static_class_ = GcRoot<Class>(nullptr); -} - -void MethodHandleImpl::VisitRoots(RootVisitor* visitor) { - static_class_.VisitRootIfNonNull(visitor, RootInfo(kRootStickyClass)); -} - mirror::MethodHandleImpl* MethodHandleImpl::Create(Thread* const self, uintptr_t art_field_or_method, MethodHandle::Kind kind, Handle<MethodType> method_type) REQUIRES_SHARED(Locks::mutator_lock_) REQUIRES(!Roles::uninterruptible_) { StackHandleScope<1> hs(self); - Handle<mirror::MethodHandleImpl> mh( - hs.NewHandle(ObjPtr<MethodHandleImpl>::DownCast(StaticClass()->AllocObject(self)))); + Handle<mirror::MethodHandleImpl> mh(hs.NewHandle(ObjPtr<MethodHandleImpl>::DownCast( + GetClassRoot<MethodHandleImpl>()->AllocObject(self)))); mh->Initialize(art_field_or_method, kind, method_type); return mh.Get(); } |
