Collapse ART's AbstractMethod class into Executable
After the OpenJDK 8 pull there is now a common base class
for Method and Constructor that can be used instead.
Methods that are abstract on Executable but on Android
were implemented in AbstractMethod are now consistently
renamed to "{method}Internal", declared final and
given package-protected access.
For consistency with all other private, natively
implemented methods, the method getDeclaredAnnotations()
has been renamed getDeclaredAnnotationsNative().
Bug: 28666126
Bug: 31052885
Test: make test-art-host and cts run of CtsLibcoreTestCases
Change-Id: Ibfe6af6a47fe0cfffd0859ffbe58980aeb84e053
diff --git a/runtime/mirror/executable.h b/runtime/mirror/executable.h
index 232fce8..6c465f6 100644
--- a/runtime/mirror/executable.h
+++ b/runtime/mirror/executable.h
@@ -32,9 +32,42 @@
// C++ mirror of java.lang.reflect.Executable.
class MANAGED Executable : public AccessibleObject {
+ public:
+ // Called from Constructor::CreateFromArtMethod, Method::CreateFromArtMethod.
+ template <PointerSize kPointerSize, bool kTransactionActive>
+ bool CreateFromArtMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_)
+ REQUIRES(!Roles::uninterruptible_);
+
+ ArtMethod* GetArtMethod() REQUIRES_SHARED(Locks::mutator_lock_);
+ // Only used by the image writer.
+ template <bool kTransactionActive = false>
+ void SetArtMethod(ArtMethod* method) REQUIRES_SHARED(Locks::mutator_lock_);
+ mirror::Class* GetDeclaringClass() REQUIRES_SHARED(Locks::mutator_lock_);
+
private:
uint16_t has_real_parameter_data_;
+ HeapReference<mirror::Class> declaring_class_;
+ HeapReference<mirror::Class> declaring_class_of_overridden_method_;
HeapReference<mirror::Array> parameters_;
+ uint64_t art_method_;
+ uint32_t access_flags_;
+ uint32_t dex_method_index_;
+
+ static MemberOffset ArtMethodOffset() {
+ return MemberOffset(OFFSETOF_MEMBER(Executable, art_method_));
+ }
+ static MemberOffset DeclaringClassOffset() {
+ return MemberOffset(OFFSETOF_MEMBER(Executable, declaring_class_));
+ }
+ static MemberOffset DeclaringClassOfOverriddenMethodOffset() {
+ return MemberOffset(OFFSETOF_MEMBER(Executable, declaring_class_of_overridden_method_));
+ }
+ static MemberOffset AccessFlagsOffset() {
+ return MemberOffset(OFFSETOF_MEMBER(Executable, access_flags_));
+ }
+ static MemberOffset DexMethodIndexOffset() {
+ return MemberOffset(OFFSETOF_MEMBER(Executable, dex_method_index_));
+ }
friend struct art::ExecutableOffsets; // for verifying offset information
DISALLOW_IMPLICIT_CONSTRUCTORS(Executable);