ART: Rename ArtMethod's size and alignment methods.
Remove the historical prefix "Object" to avoid confusion
with Java objects.
Change-Id: Ib36422c9a24878d8d4bd757977d99cbf66b3d567
diff --git a/runtime/art_method-inl.h b/runtime/art_method-inl.h
index 51398ca..40bb9e1 100644
--- a/runtime/art_method-inl.h
+++ b/runtime/art_method-inl.h
@@ -506,7 +506,7 @@
inline void ArtMethod::CopyFrom(const ArtMethod* src, size_t image_pointer_size) {
memcpy(reinterpret_cast<void*>(this), reinterpret_cast<const void*>(src),
- ObjectSize(image_pointer_size));
+ Size(image_pointer_size));
declaring_class_ = GcRoot<mirror::Class>(const_cast<ArtMethod*>(src)->GetDeclaringClass());
dex_cache_resolved_methods_ = GcRoot<mirror::PointerArray>(
const_cast<ArtMethod*>(src)->GetDexCacheResolvedMethods());
diff --git a/runtime/art_method.h b/runtime/art_method.h
index 8221fe2..1afd056 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -507,16 +507,16 @@
bool EqualParameters(Handle<mirror::ObjectArray<mirror::Class>> params)
SHARED_REQUIRES(Locks::mutator_lock_);
- // Size of an instance of this object.
- static size_t ObjectSize(size_t pointer_size) {
+ // Size of an instance of this native class.
+ static size_t Size(size_t pointer_size) {
return RoundUp(OFFSETOF_MEMBER(ArtMethod, ptr_sized_fields_), pointer_size) +
(sizeof(PtrSizedFields) / sizeof(void*)) * pointer_size;
}
- // Alignment of an instance of this object.
- static size_t ObjectAlignment(size_t pointer_size) {
+ // Alignment of an instance of this native class.
+ static size_t Alignment(size_t pointer_size) {
// The ArtMethod alignment is the same as image pointer size. This differs from
- // alignof(ArtMethod) if cross-compiling with image_pointer_size_ != sizeof(void*).
+ // alignof(ArtMethod) if cross-compiling with pointer_size != sizeof(void*).
return pointer_size;
}
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index ef48710..c179c64 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2307,8 +2307,8 @@
if (length == 0) {
return nullptr;
}
- const size_t method_alignment = ArtMethod::ObjectAlignment(image_pointer_size_);
- const size_t method_size = ArtMethod::ObjectSize(image_pointer_size_);
+ const size_t method_alignment = ArtMethod::Alignment(image_pointer_size_);
+ const size_t method_size = ArtMethod::Size(image_pointer_size_);
const size_t storage_size =
LengthPrefixedArray<ArtMethod>::ComputeSize(length, method_size, method_alignment);
void* array_storage = Runtime::Current()->GetLinearAlloc()->Alloc(self, storage_size);
@@ -4692,8 +4692,8 @@
const bool have_interfaces = interfaces.Get() != nullptr;
const size_t num_interfaces =
have_interfaces ? interfaces->GetLength() : klass->NumDirectInterfaces();
- const size_t method_alignment = ArtMethod::ObjectAlignment(image_pointer_size_);
- const size_t method_size = ArtMethod::ObjectSize(image_pointer_size_);
+ const size_t method_alignment = ArtMethod::Alignment(image_pointer_size_);
+ const size_t method_size = ArtMethod::Size(image_pointer_size_);
if (num_interfaces == 0) {
if (super_ifcount == 0) {
// Class implements no interfaces.
@@ -5901,8 +5901,8 @@
}
ArtMethod* ClassLinker::CreateRuntimeMethod() {
- const size_t method_alignment = ArtMethod::ObjectAlignment(image_pointer_size_);
- const size_t method_size = ArtMethod::ObjectSize(image_pointer_size_);
+ const size_t method_alignment = ArtMethod::Alignment(image_pointer_size_);
+ const size_t method_size = ArtMethod::Size(image_pointer_size_);
LengthPrefixedArray<ArtMethod>* method_array = AllocArtMethodArray(Thread::Current(), 1);
ArtMethod* method = &method_array->At(0, method_size, method_alignment);
CHECK(method != nullptr);
diff --git a/runtime/entrypoints/entrypoint_utils.cc b/runtime/entrypoints/entrypoint_utils.cc
index eaf26bc..eaf33f6 100644
--- a/runtime/entrypoints/entrypoint_utils.cc
+++ b/runtime/entrypoints/entrypoint_utils.cc
@@ -298,7 +298,7 @@
interface_method->GetArtMethod(), sizeof(void*));
auto* virtual_methods = proxy_class->GetVirtualMethodsPtr();
size_t num_virtuals = proxy_class->NumVirtualMethods();
- size_t method_size = ArtMethod::ObjectSize(sizeof(void*));
+ size_t method_size = ArtMethod::Size(sizeof(void*));
int throws_index = (reinterpret_cast<uintptr_t>(proxy_method) -
reinterpret_cast<uintptr_t>(virtual_methods)) / method_size;
CHECK_LT(throws_index, static_cast<int>(num_virtuals));
diff --git a/runtime/fault_handler.cc b/runtime/fault_handler.cc
index 47f9b1b..c3a9627 100644
--- a/runtime/fault_handler.cc
+++ b/runtime/fault_handler.cc
@@ -331,7 +331,7 @@
// If we don't have a potential method, we're outta here.
VLOG(signals) << "potential method: " << method_obj;
// TODO: Check linear alloc and image.
- DCHECK_ALIGNED(ArtMethod::ObjectSize(sizeof(void*)), sizeof(void*))
+ DCHECK_ALIGNED(ArtMethod::Size(sizeof(void*)), sizeof(void*))
<< "ArtMethod is not pointer aligned";
if (method_obj == nullptr || !IsAligned<sizeof(void*)>(method_obj)) {
VLOG(signals) << "no method";
diff --git a/runtime/image.cc b/runtime/image.cc
index 5890947b..2586959 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -160,8 +160,8 @@
void ImageSection::VisitPackedArtMethods(ArtMethodVisitor* visitor,
uint8_t* base,
size_t pointer_size) const {
- const size_t method_alignment = ArtMethod::ObjectAlignment(pointer_size);
- const size_t method_size = ArtMethod::ObjectSize(pointer_size);
+ const size_t method_alignment = ArtMethod::Alignment(pointer_size);
+ const size_t method_size = ArtMethod::Size(pointer_size);
for (size_t pos = 0; pos < Size(); ) {
auto* array = reinterpret_cast<LengthPrefixedArray<ArtMethod>*>(base + Offset() + pos);
for (size_t i = 0; i < array->Length(); ++i) {
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index b15747f..ac9cb09 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -93,8 +93,8 @@
auto* methods = GetDirectMethodsPtrUnchecked();
DCHECK(methods != nullptr);
return &methods->At(i,
- ArtMethod::ObjectSize(pointer_size),
- ArtMethod::ObjectAlignment(pointer_size));
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
inline ArtMethod* Class::GetDirectMethod(size_t i, size_t pointer_size) {
@@ -102,8 +102,8 @@
auto* methods = GetDirectMethodsPtr();
DCHECK(methods != nullptr);
return &methods->At(i,
- ArtMethod::ObjectSize(pointer_size),
- ArtMethod::ObjectAlignment(pointer_size));
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
template<VerifyObjectFlags kVerifyFlags>
@@ -138,8 +138,8 @@
LengthPrefixedArray<ArtMethod>* methods = GetVirtualMethodsPtrUnchecked();
DCHECK(methods != nullptr);
return &methods->At(i,
- ArtMethod::ObjectSize(pointer_size),
- ArtMethod::ObjectAlignment(pointer_size));
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
inline PointerArray* Class::GetVTable() {
@@ -843,15 +843,15 @@
inline IterationRange<StrideIterator<ArtMethod>> Class::GetDirectMethods(size_t pointer_size) {
CheckPointerSize(pointer_size);
return MakeIterationRangeFromLengthPrefixedArray(GetDirectMethodsPtrUnchecked(),
- ArtMethod::ObjectSize(pointer_size),
- ArtMethod::ObjectAlignment(pointer_size));
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
inline IterationRange<StrideIterator<ArtMethod>> Class::GetVirtualMethods(size_t pointer_size) {
CheckPointerSize(pointer_size);
return MakeIterationRangeFromLengthPrefixedArray(GetVirtualMethodsPtrUnchecked(),
- ArtMethod::ObjectSize(pointer_size),
- ArtMethod::ObjectAlignment(pointer_size));
+ ArtMethod::Size(pointer_size),
+ ArtMethod::Alignment(pointer_size));
}
inline IterationRange<StrideIterator<ArtField>> Class::GetIFields() {