diff options
author | 2015-06-18 17:40:00 +0100 | |
---|---|---|
committer | 2015-06-18 19:15:13 +0100 | |
commit | 2d1a0a408fd148f7b2a2d670e6942ec3d920f875 (patch) | |
tree | 1bb97d1ae32fbf5ce91fbfc71491b6c1eca6c69e | |
parent | 3d266a96750db6969f24bcdb8025c06745e5a449 (diff) |
Quick: Don't expect move-exception in every catch block.
The dalvik bytecode doesn't require a move-exception in
a catch handler that ignores the exception.
Bug: 21873167
Change-Id: I3b49218a8c7ff021141387bd929bb2ae798f8509
-rw-r--r-- | compiler/dex/mir_graph.cc | 11 | ||||
-rw-r--r-- | test/800-smali/expected.txt | 1 | ||||
-rw-r--r-- | test/800-smali/smali/b_21873167.smali | 18 | ||||
-rw-r--r-- | test/800-smali/src/Main.java | 1 |
4 files changed, 26 insertions, 5 deletions
diff --git a/compiler/dex/mir_graph.cc b/compiler/dex/mir_graph.cc index 9fa5148ced..920be0b4e6 100644 --- a/compiler/dex/mir_graph.cc +++ b/compiler/dex/mir_graph.cc @@ -398,12 +398,13 @@ bool MIRGraph::IsBadMonitorExitCatch(NarrowDexOffset monitor_exit_offset, DCHECK(monitor_exit->Opcode() == Instruction::MONITOR_EXIT); int monitor_reg = monitor_exit->VRegA_11x(); const Instruction* check_insn = Instruction::At(current_code_item_->insns_ + catch_offset); - DCHECK(check_insn->Opcode() == Instruction::MOVE_EXCEPTION); - if (check_insn->VRegA_11x() == monitor_reg) { - // Unexpected move-exception to the same register. Probably not the pattern we're looking for. - return false; + if (check_insn->Opcode() == Instruction::MOVE_EXCEPTION) { + if (check_insn->VRegA_11x() == monitor_reg) { + // Unexpected move-exception to the same register. Probably not the pattern we're looking for. + return false; + } + check_insn = check_insn->Next(); } - check_insn = check_insn->Next(); while (true) { int dest = -1; bool wide = false; diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt index 5927ee3859..3c6506b6b4 100644 --- a/test/800-smali/expected.txt +++ b/test/800-smali/expected.txt @@ -18,4 +18,5 @@ EmptySparseSwitch b/20224106 b/17410612 b/21865464 +b/21873167 Done! diff --git a/test/800-smali/smali/b_21873167.smali b/test/800-smali/smali/b_21873167.smali new file mode 100644 index 0000000000..c0c09cbbf2 --- /dev/null +++ b/test/800-smali/smali/b_21873167.smali @@ -0,0 +1,18 @@ +.class public LB21873167; +.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 + :start + monitor-enter p0 + monitor-exit p0 + :end + return-void + .catchall {:start .. :end} :end +.end method diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java index 0e11519354..d1c275cfef 100644 --- a/test/800-smali/src/Main.java +++ b/test/800-smali/src/Main.java @@ -85,6 +85,7 @@ public class Main { 0)); testCases.add(new TestCase("b/21865464", "B21865464", "run", null, null, null)); + testCases.add(new TestCase("b/21873167", "B21873167", "test", null, null, null)); } public void runTests() { |