summaryrefslogtreecommitdiffstats
path: root/runtime/verifier
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-03-12 11:05:47 -0700
committerAndreas Gampe <agampe@google.com>2015-03-12 11:08:21 -0700
commitd7f8d05987e08723de008ba6dbbf66acb7db0f24 (patch)
treeb7c7eba735371151df11ca6d428a66468d72b308 /runtime/verifier
parent63a63fc38115c415863b8b2d56b012ae3d9e00c7 (diff)
downloadart-d7f8d05987e08723de008ba6dbbf66acb7db0f24.zip
art-d7f8d05987e08723de008ba6dbbf66acb7db0f24.tar.gz
art-d7f8d05987e08723de008ba6dbbf66acb7db0f24.tar.bz2
ART: Save work-line for pending runtime failure
When we detect a pending runtime failure, we'll handle it as a generic throw, no matter the instruction type. But we won't have saved the work-line, which means we'll try to merge garbage into the handler's line. Copy the work-line when we set the failure. Bug: 19634276 Change-Id: I54df9e9492cd48802f93e2f1938adaadc55c9bd5
Diffstat (limited to 'runtime/verifier')
-rw-r--r--runtime/verifier/method_verifier.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index a48735b..b3f686d 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -572,6 +572,17 @@ std::ostream& MethodVerifier::Fail(VerifyError error) {
// If we fail again at runtime, mark that this instruction would throw and force this
// method to be executed using the interpreter with checks.
have_pending_runtime_throw_failure_ = true;
+
+ // We need to save the work_line if the instruction wasn't throwing before. Otherwise we'll
+ // try to merge garbage.
+ // Note: this assumes that Fail is called before we do any work_line modifications.
+ const uint16_t* insns = code_item_->insns_ + work_insn_idx_;
+ const Instruction* inst = Instruction::At(insns);
+ int opcode_flags = Instruction::FlagsOf(inst->Opcode());
+
+ if ((opcode_flags & Instruction::kThrow) == 0 && CurrentInsnFlags()->IsInTry()) {
+ saved_line_->CopyFromLine(work_line_.get());
+ }
}
break;
// Indication that verification should be retried at runtime.