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
diff --git a/runtime/method_handles.cc b/runtime/method_handles.cc
index 27de725..28df174 100644
--- a/runtime/method_handles.cc
+++ b/runtime/method_handles.cc
@@ -18,6 +18,7 @@
#include "android-base/stringprintf.h"
+#include "class_root.h"
#include "common_dex_operations.h"
#include "interpreter/shadow_frame-inl.h"
#include "jvalue-inl.h"
@@ -1022,7 +1023,7 @@
// Check that the first parameter is a VarHandle
if (callsite_ptypes->GetLength() < 1 ||
!mh_ptypes->Get(0)->IsAssignableFrom(callsite_ptypes->Get(0)) ||
- mh_ptypes->Get(0) != mirror::VarHandle::StaticClass()) {
+ mh_ptypes->Get(0) != GetClassRoot<mirror::VarHandle>()) {
ThrowWrongMethodTypeException(method_handle->GetMethodType(), callsite_type.Get());
return false;
}
@@ -1036,7 +1037,7 @@
// Cast to VarHandle instance
Handle<mirror::VarHandle> vh(hs.NewHandle(down_cast<mirror::VarHandle*>(receiver)));
- DCHECK(mirror::VarHandle::StaticClass()->IsAssignableFrom(vh->GetClass()));
+ DCHECK(GetClassRoot<mirror::VarHandle>()->IsAssignableFrom(vh->GetClass()));
// Determine the accessor kind to dispatch
ArtMethod* target_method = method_handle->GetTargetMethod();