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
diff --git a/runtime/art_method.cc b/runtime/art_method.cc
index c4d961f..113827a 100644
--- a/runtime/art_method.cc
+++ b/runtime/art_method.cc
@@ -16,6 +16,8 @@
 
 #include "art_method.h"
 
+#include <cstddef>
+
 #include "arch/context.h"
 #include "art_field-inl.h"
 #include "art_method-inl.h"
@@ -498,6 +500,18 @@
 }
 
 bool ArtMethod::IsImagePointerSize(size_t pointer_size) {
+  // Hijack this function to get access to PtrSizedFieldsOffset.
+  //
+  // Ensure that PrtSizedFieldsOffset is correct. We rely here on usually having both 32-bit and
+  // 64-bit builds.
+  static_assert(std::is_standard_layout<ArtMethod>::value, "ArtMethod is not standard layout.");
+  static_assert((sizeof(void*) != 4) ||
+                    (offsetof(ArtMethod, ptr_sized_fields_) == PtrSizedFieldsOffset(4)),
+                "Unexpected 32-bit class layout.");
+  static_assert((sizeof(void*) != 8) ||
+                    (offsetof(ArtMethod, ptr_sized_fields_) == PtrSizedFieldsOffset(8)),
+                "Unexpected 64-bit class layout.");
+
   Runtime* runtime = Runtime::Current();
   if (runtime == nullptr) {
     return true;