summaryrefslogtreecommitdiff
path: root/runtime/art_method.h
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2016-07-19 18:27:17 -0700
committer Andreas Gampe <agampe@google.com> 2016-07-21 15:47:35 -0700
commit479b1de64cd7a8c9c8ca182c699cb2048850c35d (patch)
treebca0b26c4e210e56d25baca49f7a25ffe9178813 /runtime/art_method.h
parent75f0885d7c3d72a0351912b6d47682e1c860efdf (diff)
ART: Remove PACKED from ArtMethod's ptr_sized_fields_
Remove the PACKED(4) hack, as it's highly annoying when debugging a 64-bit process. Instead, fix the actual offset and size computation for cross-size accesses. Test: m test-art-host Change-Id: I295c78760b74b6a62946e76856f218b4eb159cdc
Diffstat (limited to 'runtime/art_method.h')
-rw-r--r--runtime/art_method.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/runtime/art_method.h b/runtime/art_method.h
index 91a44248fa..d75113e58d 100644
--- a/runtime/art_method.h
+++ b/runtime/art_method.h
@@ -17,6 +17,8 @@
#ifndef ART_RUNTIME_ART_METHOD_H_
#define ART_RUNTIME_ART_METHOD_H_
+#include <cstddef>
+
#include "base/bit_utils.h"
#include "base/casts.h"
#include "dex_file.h"
@@ -219,7 +221,7 @@ class ImtConflictTable {
class ArtMethod FINAL {
public:
ArtMethod() : access_flags_(0), dex_code_item_offset_(0), dex_method_index_(0),
- method_index_(0) { }
+ method_index_(0), hotness_count_(0) { }
ArtMethod(ArtMethod* src, size_t image_pointer_size) {
CopyFrom(src, image_pointer_size);
@@ -657,7 +659,7 @@ class ArtMethod FINAL {
// 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) +
+ return PtrSizedFieldsOffset(pointer_size) +
(sizeof(PtrSizedFields) / sizeof(void*)) * pointer_size;
}
@@ -744,9 +746,7 @@ class ArtMethod FINAL {
// Fake padding field gets inserted here.
// Must be the last fields in the method.
- // PACKED(4) is necessary for the correctness of
- // RoundUp(OFFSETOF_MEMBER(ArtMethod, ptr_sized_fields_), pointer_size).
- struct PACKED(4) PtrSizedFields {
+ struct PtrSizedFields {
// Short cuts to declaring_class_->dex_cache_ member for fast compiled code access.
ArtMethod** dex_cache_resolved_methods_;
@@ -763,9 +763,9 @@ class ArtMethod FINAL {
} ptr_sized_fields_;
private:
- static size_t PtrSizedFieldsOffset(size_t pointer_size) {
- // Round up to pointer size for padding field.
- return RoundUp(OFFSETOF_MEMBER(ArtMethod, ptr_sized_fields_), pointer_size);
+ static constexpr size_t PtrSizedFieldsOffset(size_t pointer_size) {
+ // Round up to pointer size for padding field. Tested in art_method.cc.
+ return RoundUp(offsetof(ArtMethod, hotness_count_) + sizeof(hotness_count_), pointer_size);
}
// Compare given pointer size to the image pointer size.