Clear exception when no move-exception on portable.
Change-Id: I36c523e479c7dc6f752b7240f4334e1e5e417190
diff --git a/runtime/entrypoints/portable/portable_throw_entrypoints.cc b/runtime/entrypoints/portable/portable_throw_entrypoints.cc
index 4b2b46b..64a67eb 100644
--- a/runtime/entrypoints/portable/portable_throw_entrypoints.cc
+++ b/runtime/entrypoints/portable/portable_throw_entrypoints.cc
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include "dex_instruction.h"
#include "entrypoints/entrypoint_utils.h"
#include "mirror/abstract_method-inl.h"
#include "mirror/object-inl.h"
@@ -116,6 +117,11 @@
current_method,
catch_dex_pc,
exception);
+ // If the catch block has no move-exception then clear the exception for it.
+ const Instruction* first_catch_instr = Instruction::At(&mh.GetCodeItem()->insns_[catch_dex_pc]);
+ if (first_catch_instr->Opcode() != Instruction::MOVE_EXCEPTION) {
+ self->ClearException();
+ }
}
return result;
}