From e47637cc7c96e654d2c340e6006c232c8078673b Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Thu, 19 Sep 2013 15:13:16 -0700 Subject: 4-byte align 64-bit values in Get/Set Double/Long for GCC 4.8. Bug: 10837416 Change-Id: Ibb562407d81c2085666ae8824e7570f22e56eaa7 --- runtime/stack.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'runtime/stack.h') diff --git a/runtime/stack.h b/runtime/stack.h index 8ecf8f0..7c87f45 100644 --- a/runtime/stack.h +++ b/runtime/stack.h @@ -138,13 +138,17 @@ class ShadowFrame { int64_t GetVRegLong(size_t i) const { DCHECK_LT(i, NumberOfVRegs()); const uint32_t* vreg = &vregs_[i]; - return *reinterpret_cast(vreg); + // Alignment attribute required for GCC 4.8 + typedef const int64_t unaligned_int64 __attribute__ ((aligned (4))); + return *reinterpret_cast(vreg); } double GetVRegDouble(size_t i) const { DCHECK_LT(i, NumberOfVRegs()); const uint32_t* vreg = &vregs_[i]; - return *reinterpret_cast(vreg); + // Alignment attribute required for GCC 4.8 + typedef const double unaligned_double __attribute__ ((aligned (4))); + return *reinterpret_cast(vreg); } mirror::Object* GetVRegReference(size_t i) const { @@ -177,13 +181,17 @@ class ShadowFrame { void SetVRegLong(size_t i, int64_t val) { DCHECK_LT(i, NumberOfVRegs()); uint32_t* vreg = &vregs_[i]; - *reinterpret_cast(vreg) = val; + // Alignment attribute required for GCC 4.8 + typedef int64_t unaligned_int64 __attribute__ ((aligned (4))); + *reinterpret_cast(vreg) = val; } void SetVRegDouble(size_t i, double val) { DCHECK_LT(i, NumberOfVRegs()); uint32_t* vreg = &vregs_[i]; - *reinterpret_cast(vreg) = val; + // Alignment attribute required for GCC 4.8 + typedef double unaligned_double __attribute__ ((aligned (4))); + *reinterpret_cast(vreg) = val; } void SetVRegReference(size_t i, mirror::Object* val) { -- cgit v1.1