OSDN Git Service

ART: Instanceof returns true if ref == 0 on x86-64
authorAlexei Zavjalov <alexei.zavjalov@intel.com>
Mon, 9 Jun 2014 16:27:46 +0000 (23:27 +0700)
committerAlexei Zavjalov <alexei.zavjalov@intel.com>
Mon, 16 Jun 2014 05:32:42 +0000 (12:32 +0700)
On x86-64 platform rl_result and kArg0 is not the same, so we have to
handle this in the proper way.

Change-Id: Ia651f5dd8dd2cf584f510739ed58b46197dfee94
Signed-off-by: Alexei Zavjalov <alexei.zavjalov@intel.com>
compiler/dex/quick/x86/int_x86.cc

index 05b5e43..f6f0c84 100644 (file)
@@ -2352,6 +2352,11 @@ void X86Mir2Lir::GenInstanceofCallingHelper(bool needs_access_check, bool type_k
   /* kArg0 is ref, kArg2 is class. If ref==null, use directly as bool result. */
   RegLocation rl_result = GetReturn(kRefReg);
 
+  // On x86-64 kArg0 is not EAX, so we have to copy ref from kArg0 to EAX.
+  if (Gen64Bit()) {
+    OpRegCopy(rl_result.reg, TargetReg(kArg0));
+  }
+
   // For 32-bit, SETcc only works with EAX..EDX.
   DCHECK_LT(rl_result.reg.GetRegNum(), 4);