Basic implementation of invoke / invoke-polymorphic.
Basic switch interpreter support for invoke-polymorphic. This change
allows for virtual/interface and static invokes on method handles.
Support for direct invokes (including constructors) and field
getters and setters will be added in follow up changes.
Bug: 30550796
Test: make test-art-host
Change-Id: Ieb3a991d974060d930d56467908d5c7c11d0e38e
diff --git a/runtime/mirror/method_handle_impl.h b/runtime/mirror/method_handle_impl.h
index a0aae3c..40716ad 100644
--- a/runtime/mirror/method_handle_impl.h
+++ b/runtime/mirror/method_handle_impl.h
@@ -20,6 +20,7 @@
#include "class.h"
#include "gc_root.h"
#include "object.h"
+#include "method_handles.h"
#include "method_type.h"
namespace art {
@@ -40,6 +41,13 @@
GetField64(OFFSET_OF_OBJECT_MEMBER(MethodHandle, art_field_or_method_)));
}
+ MethodHandleKind GetHandleKind() REQUIRES_SHARED(Locks::mutator_lock_) {
+ const int32_t handle_kind = GetField32(OFFSET_OF_OBJECT_MEMBER(MethodHandle, handle_kind_));
+
+ DCHECK(handle_kind >= 0 && handle_kind <= MethodHandleKind::kLastValidKind);
+ return static_cast<MethodHandleKind>(handle_kind);
+ }
+
private:
HeapReference<mirror::Object> as_type_cache_;
HeapReference<mirror::MethodType> method_type_;