diff options
author | Jeff Hao <jeffhao@google.com> | 2015-06-17 16:04:26 -0700 |
---|---|---|
committer | Jeff Hao <jeffhao@google.com> | 2015-06-19 10:17:44 -0700 |
commit | 3e91a44bc9063f7f69b5415e3cf162991f73283f (patch) | |
tree | c90ca32de5e94c5f3b0407828f2bf9e3b19062b6 | |
parent | e7738e8bf567153fde593404d380a5c79ba6bfa8 (diff) | |
download | android_art-3e91a44bc9063f7f69b5415e3cf162991f73283f.tar.gz android_art-3e91a44bc9063f7f69b5415e3cf162991f73283f.tar.bz2 android_art-3e91a44bc9063f7f69b5415e3cf162991f73283f.zip |
Fix case where block has no predecessor for StringChange.
Removes part that checks for throwing half of instruction. It's no
longer necessary. Also adds regression test.
Bug: 21902684
Change-Id: Ic600165e6b3719de3d83a73b8a1fa64473668fc8
-rw-r--r-- | compiler/dex/mir_optimization.cc | 8 | ||||
-rw-r--r-- | test/800-smali/expected.txt | 1 | ||||
-rw-r--r-- | test/800-smali/smali/b_21902684.smali | 17 | ||||
-rw-r--r-- | test/800-smali/src/Main.java | 1 |
4 files changed, 20 insertions, 7 deletions
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc index 727d0fd759..5bb0ce3ba5 100644 --- a/compiler/dex/mir_optimization.cc +++ b/compiler/dex/mir_optimization.cc @@ -1667,15 +1667,9 @@ void MIRGraph::StringChange() { if (opcode == Instruction::NEW_INSTANCE) { uint32_t type_idx = mir->dalvikInsn.vB; if (cu_->compiler_driver->IsStringTypeIndex(type_idx, cu_->dex_file)) { - // Change NEW_INSTANCE and throwing half of the insn (if it exists) into CONST_4 of 0 + // Change NEW_INSTANCE into CONST_4 of 0 mir->dalvikInsn.opcode = Instruction::CONST_4; mir->dalvikInsn.vB = 0; - MIR* check_mir = GetBasicBlock(bb->predecessors[0])->last_mir_insn; - if (check_mir != nullptr && - static_cast<int>(check_mir->dalvikInsn.opcode) == kMirOpCheck) { - check_mir->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpNop); - check_mir->dalvikInsn.vB = 0; - } } } else if ((opcode == Instruction::INVOKE_DIRECT) || (opcode == Instruction::INVOKE_DIRECT_RANGE)) { diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt index e2075da910..284c7ecb2c 100644 --- a/test/800-smali/expected.txt +++ b/test/800-smali/expected.txt @@ -18,4 +18,5 @@ EmptySparseSwitch b/20224106 b/21873167 b/21614284 +b/21902684 Done! diff --git a/test/800-smali/smali/b_21902684.smali b/test/800-smali/smali/b_21902684.smali new file mode 100644 index 0000000000..2d906b61bd --- /dev/null +++ b/test/800-smali/smali/b_21902684.smali @@ -0,0 +1,17 @@ +.class public LB21902684; +.super Ljava/lang/Object; + +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public test()V + .registers 1 + goto :end + new-instance v0, Ljava/lang/String; + invoke-direct {v0}, Ljava/lang/String;-><init>()V + :end + return-void +.end method diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java index 4c6da63498..8d66783324 100644 --- a/test/800-smali/src/Main.java +++ b/test/800-smali/src/Main.java @@ -84,6 +84,7 @@ public class Main { testCases.add(new TestCase("b/21873167", "B21873167", "test", null, null, null)); testCases.add(new TestCase("b/21614284", "B21614284", "test", new Object[] { null }, new NullPointerException(), null)); + testCases.add(new TestCase("b/21902684", "B21902684", "test", null, null, null)); } public void runTests() { |