summaryrefslogtreecommitdiffstats
path: root/runtime/stack.h
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2013-09-19 16:08:57 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-19 16:08:57 -0700
commit7c748a2f0c04a088471eff7cd311c024cbbdc04e (patch)
tree6fa0e7cabd5889de547e3a4977ca9eb6d52a1f19 /runtime/stack.h
parent5712d5d04640925970db9c98938ffaf806b3962c (diff)
parente47637cc7c96e654d2c340e6006c232c8078673b (diff)
downloadart-7c748a2f0c04a088471eff7cd311c024cbbdc04e.zip
art-7c748a2f0c04a088471eff7cd311c024cbbdc04e.tar.gz
art-7c748a2f0c04a088471eff7cd311c024cbbdc04e.tar.bz2
am e47637cc: 4-byte align 64-bit values in Get/Set Double/Long for GCC 4.8.
* commit 'e47637cc7c96e654d2c340e6006c232c8078673b': 4-byte align 64-bit values in Get/Set Double/Long for GCC 4.8.
Diffstat (limited to 'runtime/stack.h')
-rw-r--r--runtime/stack.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/runtime/stack.h b/runtime/stack.h
index bd29ceb..2bf3340 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<const int64_t*>(vreg);
+ // Alignment attribute required for GCC 4.8
+ typedef const int64_t unaligned_int64 __attribute__ ((aligned (4)));
+ return *reinterpret_cast<unaligned_int64*>(vreg);
}
double GetVRegDouble(size_t i) const {
DCHECK_LT(i, NumberOfVRegs());
const uint32_t* vreg = &vregs_[i];
- return *reinterpret_cast<const double*>(vreg);
+ // Alignment attribute required for GCC 4.8
+ typedef const double unaligned_double __attribute__ ((aligned (4)));
+ return *reinterpret_cast<unaligned_double*>(vreg);
}
mirror::Object* GetVRegReference(size_t i) const {
@@ -182,13 +186,17 @@ class ShadowFrame {
void SetVRegLong(size_t i, int64_t val) {
DCHECK_LT(i, NumberOfVRegs());
uint32_t* vreg = &vregs_[i];
- *reinterpret_cast<int64_t*>(vreg) = val;
+ // Alignment attribute required for GCC 4.8
+ typedef int64_t unaligned_int64 __attribute__ ((aligned (4)));
+ *reinterpret_cast<unaligned_int64*>(vreg) = val;
}
void SetVRegDouble(size_t i, double val) {
DCHECK_LT(i, NumberOfVRegs());
uint32_t* vreg = &vregs_[i];
- *reinterpret_cast<double*>(vreg) = val;
+ // Alignment attribute required for GCC 4.8
+ typedef double unaligned_double __attribute__ ((aligned (4)));
+ *reinterpret_cast<unaligned_double*>(vreg) = val;
}
void SetVRegReference(size_t i, mirror::Object* val) {