}
bool any_dirty = false;
size_t count = 0;
- const size_t method_alignment = ArtMethod::ObjectAlignment(target_ptr_size_);
- const size_t method_size = ArtMethod::ObjectSize(target_ptr_size_);
+ const size_t method_alignment = ArtMethod::Alignment(target_ptr_size_);
+ const size_t method_size = ArtMethod::Size(target_ptr_size_);
auto iteration_range =
MakeIterationRangeFromLengthPrefixedArray(array, method_size, method_alignment);
for (auto& m : iteration_range) {
<< PrettyMethod(method);
size_t& offset = bin_slot_sizes_[BinTypeForNativeRelocationType(type)];
native_object_relocations_.emplace(method, NativeObjectRelocation { offset, type });
- offset += ArtMethod::ObjectSize(target_ptr_size_);
+ offset += ArtMethod::Size(target_ptr_size_);
}
void ImageWriter::WalkFieldsCallback(mirror::Object* obj, void* arg) {
size_t& offset = bin_slot_sizes_[BinTypeForNativeRelocationType(image_method_type)];
native_object_relocations_.emplace(&image_method_array_,
NativeObjectRelocation { offset, image_method_type });
- size_t method_alignment = ArtMethod::ObjectAlignment(target_ptr_size_);
+ size_t method_alignment = ArtMethod::Alignment(target_ptr_size_);
const size_t array_size = LengthPrefixedArray<ArtMethod>::ComputeSize(
- 0, ArtMethod::ObjectSize(target_ptr_size_), method_alignment);
+ 0, ArtMethod::Size(target_ptr_size_), method_alignment);
CHECK_ALIGNED_PARAM(array_size, method_alignment);
offset += array_size;
for (auto* m : image_methods_) {
CHECK_EQ(bin_slot_offsets_[kBinArtField], field_section->Offset());
cur_pos = field_section->End();
// Round up to the alignment the required by the method section.
- cur_pos = RoundUp(cur_pos, ArtMethod::ObjectAlignment(target_ptr_size_));
+ cur_pos = RoundUp(cur_pos, ArtMethod::Alignment(target_ptr_size_));
// Add method section.
auto* methods_section = §ions[ImageHeader::kSectionArtMethods];
*methods_section = ImageSection(cur_pos, bin_slot_sizes_[kBinArtMethodClean] +
case kNativeObjectRelocationTypeArtMethodArrayDirty: {
memcpy(dest, pair.first, LengthPrefixedArray<ArtMethod>::ComputeSize(
0,
- ArtMethod::ObjectSize(target_ptr_size_),
- ArtMethod::ObjectAlignment(target_ptr_size_)));
+ ArtMethod::Size(target_ptr_size_),
+ ArtMethod::Alignment(target_ptr_size_)));
break;
}
}
}
void ImageWriter::CopyAndFixupMethod(ArtMethod* orig, ArtMethod* copy) {
- memcpy(copy, orig, ArtMethod::ObjectSize(target_ptr_size_));
+ memcpy(copy, orig, ArtMethod::Size(target_ptr_size_));
copy->SetDeclaringClass(GetImageAddress(orig->GetDeclaringClassUnchecked()));
copy->SetDexCacheResolvedMethods(GetImageAddress(orig->GetDexCacheResolvedMethods()));
method_access_flags);
size_t total_size = dex_instruction_bytes + gc_map_bytes + pc_mapping_table_bytes +
- vmap_table_bytes + quick_oat_code_size + ArtMethod::ObjectSize(image_pointer_size);
+ vmap_table_bytes + quick_oat_code_size + ArtMethod::Size(image_pointer_size);
double expansion =
static_cast<double>(quick_oat_code_size) / static_cast<double>(dex_instruction_bytes);
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());
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;
}
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);
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.
}
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);
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));
// 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";
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) {
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) {
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>
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() {
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() {