OSDN Git Service

ART: Fix opsize in LoadArgDirect
authorAndreas Gampe <agampe@google.com>
Mon, 6 Jul 2015 21:00:39 +0000 (14:00 -0700)
committerAndreas Gampe <agampe@google.com>
Tue, 7 Jul 2015 16:46:45 +0000 (09:46 -0700)
If the destination register is a reference, use kReference for the
op size.

Bug: 22244733

(cherry picked from commit 185a5586c8b796e770e9b4b7ac2befa8ccdaca7e)

Change-Id: Idf52f2ee4c65b5dc41cb66257d95281dc6f32255

compiler/dex/quick/mir_to_lir.cc
test/800-smali/expected.txt
test/800-smali/smali/b_22244733.smali [new file with mode: 0644]
test/800-smali/src/Main.java

index 7ca03cf..c50246d 100644 (file)
@@ -193,7 +193,8 @@ void Mir2Lir::LoadArgDirect(size_t in_position, RegLocation rl_dest) {
   }
 
   if (!reg_arg.Valid()) {
-    LoadBaseDisp(TargetPtrReg(kSp), offset, rl_dest.reg, rl_dest.wide ? k64 : k32, kNotVolatile);
+    OpSize op_size = rl_dest.wide ? k64 : (rl_dest.ref ? kReference : k32);
+    LoadBaseDisp(TargetPtrReg(kSp), offset, rl_dest.reg, op_size, kNotVolatile);
   } else {
     if (rl_dest.wide) {
       OpRegCopyWide(rl_dest.reg, reg_arg);
index 2196a88..c32bfc2 100644 (file)
@@ -23,4 +23,5 @@ b/21863767
 b/21886894
 b/22080519
 b/21645819
+b/22244733
 Done!
diff --git a/test/800-smali/smali/b_22244733.smali b/test/800-smali/smali/b_22244733.smali
new file mode 100644 (file)
index 0000000..1b62ad9
--- /dev/null
@@ -0,0 +1,7 @@
+.class public LB22244733;
+.super Ljava/lang/Object;
+
+.method public static run(Ljava/lang/String;)Ljava/lang/String;
+.registers 2             # One local and one parameter.
+       return-object p0  # Simple return, use the special-method path in Quick.
+.end method
index e6f065e..a7f30d0 100644 (file)
@@ -93,6 +93,8 @@ public class Main {
                 new NullPointerException(), null));
         testCases.add(new TestCase("b/21645819", "B21645819", "run", new Object[] { null },
                 null, null));
+        testCases.add(new TestCase("b/22244733", "B22244733", "run", new Object[] { "abc" },
+                null, "abc"));
     }
 
     public void runTests() {