Merge "Fix clear growth limit not working." into dalvik-dev
diff --git a/src/dex_instruction.h b/src/dex_instruction.h
index 486bbf5..48dbb0c 100644
--- a/src/dex_instruction.h
+++ b/src/dex_instruction.h
@@ -38,7 +38,7 @@
     kArrayDataSignature = 0x0300,
   };
 
-  struct PACKED PackedSwitchPayload {
+  struct PACKED(4) PackedSwitchPayload {
     const uint16_t ident;
     const uint16_t case_count;
     const int32_t first_key;
@@ -47,7 +47,7 @@
     DISALLOW_COPY_AND_ASSIGN(PackedSwitchPayload);
   };
 
-  struct PACKED SparseSwitchPayload {
+  struct PACKED(4) SparseSwitchPayload {
     const uint16_t ident;
     const uint16_t case_count;
     const int32_t keys_and_targets[];
@@ -65,7 +65,7 @@
     DISALLOW_COPY_AND_ASSIGN(SparseSwitchPayload);
   };
 
-  struct PACKED ArrayDataPayload {
+  struct PACKED(4) ArrayDataPayload {
     const uint16_t ident;
     const uint16_t element_width;
     const uint32_t element_count;
diff --git a/src/image.h b/src/image.h
index 852367d..9ed4dc1 100644
--- a/src/image.h
+++ b/src/image.h
@@ -25,7 +25,7 @@
 namespace art {
 
 // header of image files written by ImageWriter, read and validated by Space.
-class PACKED ImageHeader {
+class PACKED(4) ImageHeader {
  public:
   ImageHeader() {}
 
diff --git a/src/macros.h b/src/macros.h
index f7146ad..d63aed6 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -125,7 +125,7 @@
 #define OFFSETOF_VOLATILE_MEMBER(t, f) \
   (reinterpret_cast<volatile char*>(&reinterpret_cast<t*>(16)->f) - reinterpret_cast<volatile char*>(16)) // NOLINT
 
-#define PACKED __attribute__ ((__packed__))
+#define PACKED(x) __attribute__ ((__aligned__(x),__packed__))
 
 #define LIKELY(x)       __builtin_expect((x), true)
 #define UNLIKELY(x)     __builtin_expect((x), false)
diff --git a/src/oat.h b/src/oat.h
index 96ed4c4..254be1a 100644
--- a/src/oat.h
+++ b/src/oat.h
@@ -25,7 +25,7 @@
 
 namespace art {
 
-class PACKED OatHeader {
+class PACKED(4) OatHeader {
  public:
   OatHeader();
   OatHeader(InstructionSet instruction_set,
@@ -68,7 +68,7 @@
   DISALLOW_COPY_AND_ASSIGN(OatHeader);
 };
 
-class PACKED OatMethodOffsets {
+class PACKED(4) OatMethodOffsets {
  public:
   OatMethodOffsets();
 
diff --git a/src/oat/runtime/oat_support_entrypoints.h b/src/oat/runtime/oat_support_entrypoints.h
index e63e1fd..e69c605 100644
--- a/src/oat/runtime/oat_support_entrypoints.h
+++ b/src/oat/runtime/oat_support_entrypoints.h
@@ -30,7 +30,7 @@
 class AbstractMethod;
 class Thread;
 
-struct PACKED EntryPoints {
+struct PACKED(4) EntryPoints {
   // Alloc
   void* (*pAllocArrayFromCode)(uint32_t, void*, int32_t);
   void* (*pAllocArrayFromCodeWithAccessCheck)(uint32_t, void*, int32_t);
diff --git a/src/object.h b/src/object.h
index 63228bc..e9851c0 100644
--- a/src/object.h
+++ b/src/object.h
@@ -157,7 +157,7 @@
 
 // Classes shared with the managed side of the world need to be packed
 // so that they don't have extra platform specific padding.
-#define MANAGED PACKED
+#define MANAGED PACKED(4)
 
 // C++ mirror of java.lang.Object
 class MANAGED Object {
diff --git a/src/runtime.h b/src/runtime.h
index 79c0592..c596a17 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -317,7 +317,7 @@
   }
 
   AbstractMethod* GetCalleeSaveMethod(CalleeSaveType type) const {
-    CHECK(HasCalleeSaveMethod(type));
+    DCHECK(HasCalleeSaveMethod(type));
     return callee_save_methods_[type];
   }
 
diff --git a/src/runtime_stats.h b/src/runtime_stats.h
index 2d2bf0c..55e57ec 100644
--- a/src/runtime_stats.h
+++ b/src/runtime_stats.h
@@ -59,7 +59,7 @@
  * Memory allocation profiler state.  This is used both globally and
  * per-thread.
  */
-struct PACKED RuntimeStats {
+struct PACKED(4) RuntimeStats {
   RuntimeStats() {
     Clear(~0);
   }
diff --git a/src/stack.h b/src/stack.h
index 1dfd5b6..1134b25 100644
--- a/src/stack.h
+++ b/src/stack.h
@@ -236,7 +236,7 @@
 // may either be shadow frames or lists of frames using fixed frame sizes. Transition records are
 // necessary for transitions between code using different frame layouts and transitions into native
 // code.
-class PACKED ManagedStack {
+class PACKED(4) ManagedStack {
  public:
   ManagedStack()
       : link_(NULL), top_shadow_frame_(NULL), top_quick_frame_(NULL), top_quick_frame_pc_(0) {}
diff --git a/src/thread.h b/src/thread.h
index 112db2d..b56bcf1 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -103,7 +103,7 @@
   kEnterInterpreter = 8,  // Instruct managed code it should enter the interpreter.
 };
 
-class PACKED Thread {
+class PACKED(4) Thread {
  public:
   // Space to throw a StackOverflowError in.
   static const size_t kStackOverflowReservedBytes = 10 * KB;
@@ -657,7 +657,7 @@
   // 32 bits of atomically changed state and flags. Keeping as 32 bits allows and atomic CAS to
   // change from being Suspended to Runnable without a suspend request occurring.
   union StateAndFlags {
-    struct PACKED {
+    struct PACKED(4) {
       // Bitfield of flag values. Must be changed atomically so that flag values aren't lost. See
       // ThreadFlags for bit field meanings.
       volatile uint16_t flags;