Revert "Combine direct_methods_ and virtual_methods_ fields of mirror::Class"
This reverts commit 6286a97bea0f584342803a215550038852b24776.
Change-Id: I5b00f6d1350e9c587acd4b185367dc815ea707de
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index ef4fe15..9e416dc 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -22,14 +22,13 @@
#include "art_field-inl.h"
#include "art_method.h"
#include "art_method-inl.h"
-#include "base/array_slice.h"
-#include "base/length_prefixed_array.h"
#include "class_loader.h"
#include "common_throws.h"
#include "dex_cache.h"
#include "dex_file.h"
#include "gc/heap-inl.h"
#include "iftable.h"
+#include "length_prefixed_array.h"
#include "object_array-inl.h"
#include "read_barrier-inl.h"
#include "reference-inl.h"
@@ -63,148 +62,61 @@
return GetFieldObject<DexCache, kVerifyFlags>(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_));
}
-inline uint32_t Class::GetCopiedMethodsStartOffset() {
- return GetFieldShort(OFFSET_OF_OBJECT_MEMBER(Class, copied_methods_offset_));
-}
-
-inline uint32_t Class::GetDirectMethodsStartOffset() {
- return 0;
-}
-
-inline uint32_t Class::GetVirtualMethodsStartOffset() {
- return GetFieldShort(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_offset_));
-}
-
-template<VerifyObjectFlags kVerifyFlags>
-inline ArraySlice<ArtMethod> Class::GetDirectMethodsSlice(size_t pointer_size) {
+inline LengthPrefixedArray<ArtMethod>* Class::GetDirectMethodsPtr() {
DCHECK(IsLoaded() || IsErroneous());
- DCHECK(ValidPointerSize(pointer_size)) << pointer_size;
- return GetDirectMethodsSliceUnchecked(pointer_size);
+ return GetDirectMethodsPtrUnchecked();
}
-inline ArraySlice<ArtMethod> Class::GetDirectMethodsSliceUnchecked(size_t pointer_size) {
- return ArraySlice<ArtMethod>(GetMethodsPtr(),
- GetDirectMethodsStartOffset(),
- GetVirtualMethodsStartOffset(),
- ArtMethod::Size(pointer_size),
- ArtMethod::Alignment(pointer_size));
-}
-
-template<VerifyObjectFlags kVerifyFlags>
-inline ArraySlice<ArtMethod> Class::GetDeclaredMethodsSlice(size_t pointer_size) {
- DCHECK(IsLoaded() || IsErroneous());
- DCHECK(ValidPointerSize(pointer_size)) << pointer_size;
- return GetDeclaredMethodsSliceUnchecked(pointer_size);
-}
-
-inline ArraySlice<ArtMethod> Class::GetDeclaredMethodsSliceUnchecked(size_t pointer_size) {
- return ArraySlice<ArtMethod>(GetMethodsPtr(),
- GetDirectMethodsStartOffset(),
- GetCopiedMethodsStartOffset(),
- ArtMethod::Size(pointer_size),
- ArtMethod::Alignment(pointer_size));
-}
-template<VerifyObjectFlags kVerifyFlags>
-inline ArraySlice<ArtMethod> Class::GetDeclaredVirtualMethodsSlice(size_t pointer_size) {
- DCHECK(IsLoaded() || IsErroneous());
- DCHECK(ValidPointerSize(pointer_size)) << pointer_size;
- return GetDeclaredVirtualMethodsSliceUnchecked(pointer_size);
-}
-
-inline ArraySlice<ArtMethod> Class::GetDeclaredVirtualMethodsSliceUnchecked(size_t pointer_size) {
- return ArraySlice<ArtMethod>(GetMethodsPtr(),
- GetVirtualMethodsStartOffset(),
- GetCopiedMethodsStartOffset(),
- ArtMethod::Size(pointer_size),
- ArtMethod::Alignment(pointer_size));
-}
-
-template<VerifyObjectFlags kVerifyFlags>
-inline ArraySlice<ArtMethod> Class::GetVirtualMethodsSlice(size_t pointer_size) {
- DCHECK(IsLoaded() || IsErroneous());
- DCHECK(ValidPointerSize(pointer_size)) << pointer_size;
- return GetVirtualMethodsSliceUnchecked(pointer_size);
-}
-
-inline ArraySlice<ArtMethod> Class::GetVirtualMethodsSliceUnchecked(size_t pointer_size) {
- LengthPrefixedArray<ArtMethod>* methods = GetMethodsPtr();
- return ArraySlice<ArtMethod>(methods,
- GetVirtualMethodsStartOffset(),
- NumMethods(),
- ArtMethod::Size(pointer_size),
- ArtMethod::Alignment(pointer_size));
-}
-
-template<VerifyObjectFlags kVerifyFlags>
-inline ArraySlice<ArtMethod> Class::GetCopiedMethodsSlice(size_t pointer_size) {
- DCHECK(IsLoaded() || IsErroneous());
- DCHECK(ValidPointerSize(pointer_size)) << pointer_size;
- return GetCopiedMethodsSliceUnchecked(pointer_size);
-}
-
-inline ArraySlice<ArtMethod> Class::GetCopiedMethodsSliceUnchecked(size_t pointer_size) {
- LengthPrefixedArray<ArtMethod>* methods = GetMethodsPtr();
- return ArraySlice<ArtMethod>(methods,
- GetCopiedMethodsStartOffset(),
- NumMethods(),
- ArtMethod::Size(pointer_size),
- ArtMethod::Alignment(pointer_size));
-}
-
-inline LengthPrefixedArray<ArtMethod>* Class::GetMethodsPtr() {
+inline LengthPrefixedArray<ArtMethod>* Class::GetDirectMethodsPtrUnchecked() {
return reinterpret_cast<LengthPrefixedArray<ArtMethod>*>(
- GetField64(OFFSET_OF_OBJECT_MEMBER(Class, methods_)));
+ GetField64(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_)));
}
-template<VerifyObjectFlags kVerifyFlags>
-inline ArraySlice<ArtMethod> Class::GetMethodsSlice(size_t pointer_size) {
- DCHECK(IsLoaded() || IsErroneous());
- LengthPrefixedArray<ArtMethod>* methods = GetMethodsPtr();
- return ArraySlice<ArtMethod>(methods,
- 0,
- NumMethods(),
- ArtMethod::Size(pointer_size),
- ArtMethod::Alignment(pointer_size));
+inline LengthPrefixedArray<ArtMethod>* Class::GetVirtualMethodsPtrUnchecked() {
+ return reinterpret_cast<LengthPrefixedArray<ArtMethod>*>(
+ GetField64(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_)));
}
+inline void Class::SetDirectMethodsPtr(LengthPrefixedArray<ArtMethod>* new_direct_methods) {
+ DCHECK(GetDirectMethodsPtrUnchecked() == nullptr);
+ SetDirectMethodsPtrUnchecked(new_direct_methods);
+}
-inline uint32_t Class::NumMethods() {
- LengthPrefixedArray<ArtMethod>* methods = GetMethodsPtr();
- return (methods == nullptr) ? 0 : methods->size();
+inline void Class::SetDirectMethodsPtrUnchecked(
+ LengthPrefixedArray<ArtMethod>* new_direct_methods) {
+ SetField64<false>(OFFSET_OF_OBJECT_MEMBER(Class, direct_methods_),
+ reinterpret_cast<uint64_t>(new_direct_methods));
}
inline ArtMethod* Class::GetDirectMethodUnchecked(size_t i, size_t pointer_size) {
CheckPointerSize(pointer_size);
- return &GetDirectMethodsSliceUnchecked(pointer_size).At(i);
+ auto* methods = GetDirectMethodsPtrUnchecked();
+ DCHECK(methods != nullptr);
+ return &methods->At(i,
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
inline ArtMethod* Class::GetDirectMethod(size_t i, size_t pointer_size) {
CheckPointerSize(pointer_size);
- return &GetDirectMethodsSlice(pointer_size).At(i);
+ auto* methods = GetDirectMethodsPtr();
+ DCHECK(methods != nullptr);
+ return &methods->At(i,
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
-inline void Class::SetMethodsPtr(LengthPrefixedArray<ArtMethod>* new_methods,
- uint32_t num_direct,
- uint32_t num_virtual) {
- DCHECK(GetMethodsPtr() == nullptr);
- SetMethodsPtrUnchecked(new_methods, num_direct, num_virtual);
+template<VerifyObjectFlags kVerifyFlags>
+inline LengthPrefixedArray<ArtMethod>* Class::GetVirtualMethodsPtr() {
+ DCHECK(IsLoaded<kVerifyFlags>() || IsErroneous<kVerifyFlags>());
+ return GetVirtualMethodsPtrUnchecked();
}
-
-inline void Class::SetMethodsPtrUnchecked(LengthPrefixedArray<ArtMethod>* new_methods,
- uint32_t num_direct,
- uint32_t num_virtual) {
- DCHECK_LE(num_direct + num_virtual, (new_methods == nullptr) ? 0 : new_methods->size());
- SetMethodsPtrInternal(new_methods);
- SetFieldShort<false>(OFFSET_OF_OBJECT_MEMBER(Class, copied_methods_offset_),
- dchecked_integral_cast<uint16_t>(num_direct + num_virtual));
- SetFieldShort<false>(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_offset_),
- dchecked_integral_cast<uint16_t>(num_direct));
-}
-
-inline void Class::SetMethodsPtrInternal(LengthPrefixedArray<ArtMethod>* new_methods) {
- SetField64<false>(OFFSET_OF_OBJECT_MEMBER(Class, methods_),
- reinterpret_cast<uint64_t>(new_methods));
+inline void Class::SetVirtualMethodsPtr(LengthPrefixedArray<ArtMethod>* new_virtual_methods) {
+ // TODO: we reassign virtual methods to grow the table for miranda
+ // methods.. they should really just be assigned once.
+ SetField64<false>(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_),
+ reinterpret_cast<uint64_t>(new_virtual_methods));
}
template<VerifyObjectFlags kVerifyFlags>
@@ -223,7 +135,11 @@
inline ArtMethod* Class::GetVirtualMethodUnchecked(size_t i, size_t pointer_size) {
CheckPointerSize(pointer_size);
- return &GetVirtualMethodsSliceUnchecked(pointer_size).At(i);
+ LengthPrefixedArray<ArtMethod>* methods = GetVirtualMethodsPtrUnchecked();
+ DCHECK(methods != nullptr);
+ return &methods->At(i,
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
inline PointerArray* Class::GetVTable() {
@@ -917,42 +833,24 @@
CHECK_EQ(field.GetDeclaringClass(), this) << GetStatus();
}
}
- for (ArtMethod& method : GetMethods(pointer_size)) {
+ for (ArtMethod& method : GetDirectMethods(pointer_size)) {
+ method.VisitRoots(visitor, pointer_size);
+ }
+ for (ArtMethod& method : GetVirtualMethods(pointer_size)) {
method.VisitRoots(visitor, pointer_size);
}
}
inline IterationRange<StrideIterator<ArtMethod>> Class::GetDirectMethods(size_t pointer_size) {
CheckPointerSize(pointer_size);
- return GetDirectMethodsSliceUnchecked(pointer_size).AsRange();
-}
-
-inline IterationRange<StrideIterator<ArtMethod>> Class::GetDeclaredMethods(
- size_t pointer_size) {
- CheckPointerSize(pointer_size);
- return GetDeclaredMethodsSliceUnchecked(pointer_size).AsRange();
-}
-
-inline IterationRange<StrideIterator<ArtMethod>> Class::GetDeclaredVirtualMethods(
- size_t pointer_size) {
- CheckPointerSize(pointer_size);
- return GetDeclaredVirtualMethodsSliceUnchecked(pointer_size).AsRange();
+ return MakeIterationRangeFromLengthPrefixedArray(GetDirectMethodsPtrUnchecked(),
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
inline IterationRange<StrideIterator<ArtMethod>> Class::GetVirtualMethods(size_t pointer_size) {
CheckPointerSize(pointer_size);
- return GetVirtualMethodsSliceUnchecked(pointer_size).AsRange();
-}
-
-inline IterationRange<StrideIterator<ArtMethod>> Class::GetCopiedMethods(size_t pointer_size) {
- CheckPointerSize(pointer_size);
- return GetCopiedMethodsSliceUnchecked(pointer_size).AsRange();
-}
-
-
-inline IterationRange<StrideIterator<ArtMethod>> Class::GetMethods(size_t pointer_size) {
- CheckPointerSize(pointer_size);
- return MakeIterationRangeFromLengthPrefixedArray(GetMethodsPtr(),
+ return MakeIterationRangeFromLengthPrefixedArray(GetVirtualMethodsPtrUnchecked(),
ArtMethod::Size(pointer_size),
ArtMethod::Alignment(pointer_size));
}
@@ -1020,15 +918,13 @@
}
inline uint32_t Class::NumDirectMethods() {
- return GetVirtualMethodsStartOffset();
-}
-
-inline uint32_t Class::NumDeclaredVirtualMethods() {
- return GetCopiedMethodsStartOffset() - GetVirtualMethodsStartOffset();
+ LengthPrefixedArray<ArtMethod>* arr = GetDirectMethodsPtrUnchecked();
+ return arr != nullptr ? arr->size() : 0u;
}
inline uint32_t Class::NumVirtualMethods() {
- return NumMethods() - GetVirtualMethodsStartOffset();
+ LengthPrefixedArray<ArtMethod>* arr = GetVirtualMethodsPtrUnchecked();
+ return arr != nullptr ? arr->size() : 0u;
}
inline uint32_t Class::NumInstanceFields() {
@@ -1056,11 +952,16 @@
if (ifields != new_ifields) {
dest->SetIFieldsPtrUnchecked(new_ifields);
}
- // Update method array.
- LengthPrefixedArray<ArtMethod>* methods = GetMethodsPtr();
- LengthPrefixedArray<ArtMethod>* new_methods = visitor(methods);
- if (methods != new_methods) {
- dest->SetMethodsPtrInternal(new_methods);
+ // Update direct and virtual method arrays.
+ LengthPrefixedArray<ArtMethod>* direct_methods = GetDirectMethodsPtr();
+ LengthPrefixedArray<ArtMethod>* new_direct_methods = visitor(direct_methods);
+ if (direct_methods != new_direct_methods) {
+ dest->SetDirectMethodsPtrUnchecked(new_direct_methods);
+ }
+ LengthPrefixedArray<ArtMethod>* virtual_methods = GetVirtualMethodsPtr();
+ LengthPrefixedArray<ArtMethod>* new_virtual_methods = visitor(virtual_methods);
+ if (virtual_methods != new_virtual_methods) {
+ dest->SetVirtualMethodsPtr(new_virtual_methods);
}
// Update dex cache strings.
GcRoot<mirror::String>* strings = GetDexCacheStrings();
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 66060f2..05a9039 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -457,10 +457,6 @@
return nullptr;
}
-// TODO These should maybe be changed to be named FindOwnedVirtualMethod or something similar
-// because they do not only find 'declared' methods and will return copied methods. This behavior is
-// desired and correct but the naming can lead to confusion because in the java language declared
-// excludes interface methods which might be found by this.
ArtMethod* Class::FindDeclaredVirtualMethod(const StringPiece& name, const StringPiece& signature,
size_t pointer_size) {
for (auto& method : GetVirtualMethods(pointer_size)) {
@@ -486,8 +482,10 @@
ArtMethod* Class::FindDeclaredVirtualMethod(const DexCache* dex_cache, uint32_t dex_method_idx,
size_t pointer_size) {
if (GetDexCache() == dex_cache) {
- for (auto& method : GetDeclaredVirtualMethods(pointer_size)) {
- if (method.GetDexMethodIndex() == dex_method_idx) {
+ for (auto& method : GetVirtualMethods(pointer_size)) {
+ // A miranda method may have a different DexCache and is always created by linking,
+ // never *declared* in the class.
+ if (method.GetDexMethodIndex() == dex_method_idx && !method.IsMiranda()) {
return &method;
}
}
@@ -727,7 +725,12 @@
void Class::SetPreverifiedFlagOnAllMethods(size_t pointer_size) {
DCHECK(IsVerified());
- for (auto& m : GetMethods(pointer_size)) {
+ for (auto& m : GetDirectMethods(pointer_size)) {
+ if (!m.IsNative() && m.IsInvokable()) {
+ m.SetPreverified();
+ }
+ }
+ for (auto& m : GetVirtualMethods(pointer_size)) {
if (!m.IsNative() && m.IsInvokable()) {
m.SetPreverified();
}
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index ce879ba..0ab5b97 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -44,7 +44,6 @@
struct ClassOffsets;
template<class T> class Handle;
template<typename T> class LengthPrefixedArray;
-template<typename T> class ArraySlice;
class Signature;
class StringPiece;
template<size_t kNumReferences> class PACKED(4) StackHandleScope;
@@ -703,24 +702,12 @@
ALWAYS_INLINE IterationRange<StrideIterator<ArtMethod>> GetDirectMethods(size_t pointer_size)
SHARED_REQUIRES(Locks::mutator_lock_);
- ALWAYS_INLINE LengthPrefixedArray<ArtMethod>* GetMethodsPtr()
- SHARED_REQUIRES(Locks::mutator_lock_);
+ LengthPrefixedArray<ArtMethod>* GetDirectMethodsPtr() SHARED_REQUIRES(Locks::mutator_lock_);
- ALWAYS_INLINE IterationRange<StrideIterator<ArtMethod>> GetMethods(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- void SetMethodsPtr(LengthPrefixedArray<ArtMethod>* new_methods,
- uint32_t num_direct,
- uint32_t num_virtual)
+ void SetDirectMethodsPtr(LengthPrefixedArray<ArtMethod>* new_direct_methods)
SHARED_REQUIRES(Locks::mutator_lock_);
// Used by image writer.
- void SetMethodsPtrUnchecked(LengthPrefixedArray<ArtMethod>* new_methods,
- uint32_t num_direct,
- uint32_t num_virtual)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- ALWAYS_INLINE ArraySlice<ArtMethod> GetDirectMethodsSlice(size_t pointer_size)
+ void SetDirectMethodsPtrUnchecked(LengthPrefixedArray<ArtMethod>* new_direct_methods)
SHARED_REQUIRES(Locks::mutator_lock_);
ALWAYS_INLINE ArtMethod* GetDirectMethod(size_t i, size_t pointer_size)
@@ -736,50 +723,18 @@
ALWAYS_INLINE uint32_t NumDirectMethods() SHARED_REQUIRES(Locks::mutator_lock_);
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- ALWAYS_INLINE ArraySlice<ArtMethod> GetMethodsSlice(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- ALWAYS_INLINE ArraySlice<ArtMethod> GetDeclaredMethodsSlice(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- ALWAYS_INLINE IterationRange<StrideIterator<ArtMethod>> GetDeclaredMethods(
- size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- ALWAYS_INLINE ArraySlice<ArtMethod> GetDeclaredVirtualMethodsSlice(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- ALWAYS_INLINE IterationRange<StrideIterator<ArtMethod>> GetDeclaredVirtualMethods(
- size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- ALWAYS_INLINE ArraySlice<ArtMethod> GetCopiedMethodsSlice(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- ALWAYS_INLINE IterationRange<StrideIterator<ArtMethod>> GetCopiedMethods(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
- ALWAYS_INLINE ArraySlice<ArtMethod> GetVirtualMethodsSlice(size_t pointer_size)
+ ALWAYS_INLINE LengthPrefixedArray<ArtMethod>* GetVirtualMethodsPtr()
SHARED_REQUIRES(Locks::mutator_lock_);
ALWAYS_INLINE IterationRange<StrideIterator<ArtMethod>> GetVirtualMethods(size_t pointer_size)
SHARED_REQUIRES(Locks::mutator_lock_);
- // Returns the number of non-inherited virtual methods (sum of declared and copied methods).
+ void SetVirtualMethodsPtr(LengthPrefixedArray<ArtMethod>* new_virtual_methods)
+ SHARED_REQUIRES(Locks::mutator_lock_);
+
+ // Returns the number of non-inherited virtual methods.
ALWAYS_INLINE uint32_t NumVirtualMethods() SHARED_REQUIRES(Locks::mutator_lock_);
- // Returns the number of copied virtual methods.
- ALWAYS_INLINE uint32_t NumCopiedVirtualMethods() SHARED_REQUIRES(Locks::mutator_lock_);
-
- // Returns the number of declared virtual methods.
- ALWAYS_INLINE uint32_t NumDeclaredVirtualMethods() SHARED_REQUIRES(Locks::mutator_lock_);
-
- ALWAYS_INLINE uint32_t NumMethods() SHARED_REQUIRES(Locks::mutator_lock_);
-
template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
ArtMethod* GetVirtualMethod(size_t i, size_t pointer_size)
SHARED_REQUIRES(Locks::mutator_lock_);
@@ -1200,19 +1155,10 @@
return pointer_size;
}
- ALWAYS_INLINE ArraySlice<ArtMethod> GetDirectMethodsSliceUnchecked(size_t pointer_size)
+ ALWAYS_INLINE LengthPrefixedArray<ArtMethod>* GetDirectMethodsPtrUnchecked()
SHARED_REQUIRES(Locks::mutator_lock_);
- ALWAYS_INLINE ArraySlice<ArtMethod> GetVirtualMethodsSliceUnchecked(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- ALWAYS_INLINE ArraySlice<ArtMethod> GetDeclaredMethodsSliceUnchecked(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- ALWAYS_INLINE ArraySlice<ArtMethod> GetDeclaredVirtualMethodsSliceUnchecked(size_t pointer_size)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
- ALWAYS_INLINE ArraySlice<ArtMethod> GetCopiedMethodsSliceUnchecked(size_t pointer_size)
+ ALWAYS_INLINE LengthPrefixedArray<ArtMethod>* GetVirtualMethodsPtrUnchecked()
SHARED_REQUIRES(Locks::mutator_lock_);
// Fix up all of the native pointers in the class by running them through the visitor. Only sets
@@ -1223,9 +1169,6 @@
SHARED_REQUIRES(Locks::mutator_lock_);
private:
- ALWAYS_INLINE void SetMethodsPtrInternal(LengthPrefixedArray<ArtMethod>* new_methods)
- SHARED_REQUIRES(Locks::mutator_lock_);
-
void SetVerifyError(Object* klass) SHARED_REQUIRES(Locks::mutator_lock_);
template <bool throw_on_failure, bool use_referrers_cache>
@@ -1251,15 +1194,6 @@
IterationRange<StrideIterator<ArtField>> GetIFieldsUnchecked()
SHARED_REQUIRES(Locks::mutator_lock_);
- // The index in the methods_ array where the first declared virtual method is.
- ALWAYS_INLINE uint32_t GetVirtualMethodsStartOffset() SHARED_REQUIRES(Locks::mutator_lock_);
-
- // The index in the methods_ array where the first direct method is.
- ALWAYS_INLINE uint32_t GetDirectMethodsStartOffset() SHARED_REQUIRES(Locks::mutator_lock_);
-
- // The index in the methods_ array where the first copied method is.
- ALWAYS_INLINE uint32_t GetCopiedMethodsStartOffset() SHARED_REQUIRES(Locks::mutator_lock_);
-
bool ProxyDescriptorEquals(const char* match) SHARED_REQUIRES(Locks::mutator_lock_);
// Check that the pointer size matches the one in the class linker.
@@ -1272,9 +1206,6 @@
void VisitReferences(mirror::Class* klass, const Visitor& visitor)
SHARED_REQUIRES(Locks::mutator_lock_);
- // 'Class' Object Fields
- // Order governed by java field ordering. See art::ClassLinker::LinkFields.
-
// Defining class loader, or null for the "bootstrap" system loader.
HeapReference<ClassLoader> class_loader_;
@@ -1323,6 +1254,9 @@
// Short cuts to dex_cache_ member for fast compiled code access.
uint64_t dex_cache_strings_;
+ // static, private, and <init> methods. Pointer to an ArtMethod length-prefixed array.
+ uint64_t direct_methods_;
+
// instance fields
//
// These describe the layout of the contents of an Object.
@@ -1334,24 +1268,13 @@
// ArtFields.
uint64_t ifields_;
- // Pointer to an ArtMethod length-prefixed array. All the methods where this class is the place
- // where they are logically defined. This includes all private, static, final and virtual methods
- // as well as inherited default methods and miranda methods.
- //
- // The slice methods_ [0, virtual_methods_offset_) are the direct (static, private, init) methods
- // declared by this class.
- //
- // The slice methods_ [virtual_methods_offset_, copied_methods_offset_) are the virtual methods
- // declared by this class.
- //
- // The slice methods_ [copied_methods_offset_, |methods_|) are the methods that are copied from
- // interfaces such as miranda or default methods. These are copied for resolution purposes as this
- // class is where they are (logically) declared as far as the virtual dispatch is concerned.
- uint64_t methods_;
-
// Static fields length-prefixed array.
uint64_t sfields_;
+ // Virtual methods defined in this class; invoked through vtable. Pointer to an ArtMethod
+ // length-prefixed array.
+ uint64_t virtual_methods_;
+
// Access flags; low 16 bits are defined by VM spec.
uint32_t access_flags_;
@@ -1394,14 +1317,6 @@
// State of class initialization.
Status status_;
- // The offset of the first virtual method that is copied from an interface. This includes miranda,
- // default, and default-conflict methods. Having a hard limit of ((2 << 16) - 1) for methods
- // defined on a single class is well established in Java so we will use only uint16_t's here.
- uint16_t copied_methods_offset_;
-
- // The offset of the first declared virtual methods in the methods_ array.
- uint16_t virtual_methods_offset_;
-
// TODO: ?
// initiating class loader list
// NOTE: for classes with low serialNumber, these are unused, and the