summaryrefslogtreecommitdiffstats
path: root/compiler/utils
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2014-09-26 14:55:38 -0700
committerHiroshi Yamauchi <yamauchi@google.com>2014-09-29 16:21:28 -0700
commitb88f0b16dbaff09a140d2a62b66eca2736ff514b (patch)
tree4870524a0f0f8f5fbc2bbdf0157cf6092eceb327 /compiler/utils
parent7fe50c6239e298a9ff7918dbc73d9eeb6666a7dc (diff)
downloadart-b88f0b16dbaff09a140d2a62b66eca2736ff514b.zip
art-b88f0b16dbaff09a140d2a62b66eca2736ff514b.tar.gz
art-b88f0b16dbaff09a140d2a62b66eca2736ff514b.tar.bz2
Get heap poisoning working in 64-bit.
This adds the reference negate code in arm64 and x86_64 that's used by the jni compiler. Bug: 12687968 Bug: 8367515 Change-Id: I28a44bcead1ee613866645620b4eaf54fad6a3aa
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/arm64/assembler_arm64.cc4
-rw-r--r--compiler/utils/x86_64/assembler_x86_64.cc4
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/utils/arm64/assembler_arm64.cc b/compiler/utils/arm64/assembler_arm64.cc
index 3edf59b..c82b4f0 100644
--- a/compiler/utils/arm64/assembler_arm64.cc
+++ b/compiler/utils/arm64/assembler_arm64.cc
@@ -299,6 +299,10 @@ void Arm64Assembler::LoadRef(ManagedRegister m_dst, ManagedRegister m_base,
CHECK(dst.IsCoreRegister() && base.IsCoreRegister());
LoadWFromOffset(kLoadWord, dst.AsOverlappingCoreRegisterLow(), base.AsCoreRegister(),
offs.Int32Value());
+ if (kPoisonHeapReferences) {
+ WRegister ref_reg = dst.AsOverlappingCoreRegisterLow();
+ ___ Neg(reg_w(ref_reg), vixl::Operand(reg_w(ref_reg)));
+ }
}
void Arm64Assembler::LoadRawPtr(ManagedRegister m_dst, ManagedRegister m_base, Offset offs) {
diff --git a/compiler/utils/x86_64/assembler_x86_64.cc b/compiler/utils/x86_64/assembler_x86_64.cc
index a47e968..1dcd4b3 100644
--- a/compiler/utils/x86_64/assembler_x86_64.cc
+++ b/compiler/utils/x86_64/assembler_x86_64.cc
@@ -1992,6 +1992,9 @@ void X86_64Assembler::LoadRef(ManagedRegister mdest, ManagedRegister base,
X86_64ManagedRegister dest = mdest.AsX86_64();
CHECK(dest.IsCpuRegister() && dest.IsCpuRegister());
movq(dest.AsCpuRegister(), Address(base.AsX86_64().AsCpuRegister(), offs));
+ if (kPoisonHeapReferences) {
+ negl(dest.AsCpuRegister());
+ }
}
void X86_64Assembler::LoadRawPtr(ManagedRegister mdest, ManagedRegister base,
@@ -2276,4 +2279,3 @@ void X86_64ExceptionSlowPath::Emit(Assembler *sasm) {
} // namespace x86_64
} // namespace art
-