summaryrefslogtreecommitdiffstats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-06-20 11:34:17 -0700
committerAndreas Gampe <agampe@google.com>2014-06-20 11:34:17 -0700
commit49c5f50cbc8e4d8c195d8f1409abcfde08b39786 (patch)
tree843441b4031bbc71999e8c9df90b1e3078eb08b8 /compiler
parent2d2d6bb1ff8692efdddf104dabfb4a2d39877ff6 (diff)
downloadart-49c5f50cbc8e4d8c195d8f1409abcfde08b39786.zip
art-49c5f50cbc8e4d8c195d8f1409abcfde08b39786.tar.gz
art-49c5f50cbc8e4d8c195d8f1409abcfde08b39786.tar.bz2
ART: Fix register overlap checks in CopyArgumentRegs
This is a make-shift CL. Expect this to be replaced by a reworked implementation. Change-Id: Ia74697d1436efd2971bc4c791fabed66d2e9d72d
Diffstat (limited to 'compiler')
-rw-r--r--compiler/dex/quick/gen_invoke.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc
index b3fac77..638c590 100644
--- a/compiler/dex/quick/gen_invoke.cc
+++ b/compiler/dex/quick/gen_invoke.cc
@@ -363,20 +363,27 @@ void Mir2Lir::CallRuntimeHelperRegLocationRegLocation(ThreadOffset<pointer_size>
INSTANTIATE(void Mir2Lir::CallRuntimeHelperRegLocationRegLocation, RegLocation arg0,
RegLocation arg1, bool safepoint_pc)
+// TODO: This is a hack! Reshape the two macros into functions and move them to a better place.
+#define IsSameReg(r1, r2) \
+ (GetRegInfo(r1)->Master()->GetReg().GetReg() == GetRegInfo(r2)->Master()->GetReg().GetReg())
+#define TargetArgReg(arg, is_wide) \
+ (GetRegInfo(TargetReg(arg))->FindMatchingView( \
+ (is_wide) ? RegisterInfo::k64SoloStorageMask : RegisterInfo::k32SoloStorageMask)->GetReg())
+
void Mir2Lir::CopyToArgumentRegs(RegStorage arg0, RegStorage arg1) {
- if (arg1.GetReg() == TargetReg(kArg0).GetReg()) {
- if (arg0.GetReg() == TargetReg(kArg1).GetReg()) {
+ if (IsSameReg(arg1, TargetReg(kArg0))) {
+ if (IsSameReg(arg0, TargetReg(kArg1))) {
// Swap kArg0 and kArg1 with kArg2 as temp.
- OpRegCopy(TargetReg(kArg2), arg1);
- OpRegCopy(TargetReg(kArg0), arg0);
- OpRegCopy(TargetReg(kArg1), TargetReg(kArg2));
+ OpRegCopy(TargetArgReg(kArg2, arg1.Is64Bit()), arg1);
+ OpRegCopy(TargetArgReg(kArg0, arg0.Is64Bit()), arg0);
+ OpRegCopy(TargetArgReg(kArg1, arg1.Is64Bit()), TargetReg(kArg2));
} else {
- OpRegCopy(TargetReg(kArg1), arg1);
- OpRegCopy(TargetReg(kArg0), arg0);
+ OpRegCopy(TargetArgReg(kArg1, arg1.Is64Bit()), arg1);
+ OpRegCopy(TargetArgReg(kArg0, arg0.Is64Bit()), arg0);
}
} else {
- OpRegCopy(TargetReg(kArg0), arg0);
- OpRegCopy(TargetReg(kArg1), arg1);
+ OpRegCopy(TargetArgReg(kArg0, arg0.Is64Bit()), arg0);
+ OpRegCopy(TargetArgReg(kArg1, arg1.Is64Bit()), arg1);
}
}