Merge "ART: More cutouts for unstarted runtime"
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index 09790fe..6b6a9e0 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -77,8 +77,14 @@
ART_GTEST_elf_writer_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
ART_GTEST_elf_writer_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_default_no-pic_64) $(TARGET_CORE_IMAGE_default_no-pic_32)
-ART_GTEST_oat_file_assistant_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
-ART_GTEST_oat_file_assistant_test_TARGET_DEPS := $(TARGET_CORE_IMAGE_default_no-pic_64) $(TARGET_CORE_IMAGE_default_no-pic_32)
+ART_GTEST_oat_file_assistant_test_HOST_DEPS := \
+ $(HOST_CORE_IMAGE_default_no-pic_64) \
+ $(HOST_CORE_IMAGE_default_no-pic_32) \
+ $(HOST_OUT_EXECUTABLES)/patchoatd
+ART_GTEST_oat_file_assistant_test_TARGET_DEPS := \
+ $(TARGET_CORE_IMAGE_default_no-pic_64) \
+ $(TARGET_CORE_IMAGE_default_no-pic_32) \
+ $(TARGET_OUT_EXECUTABLES)/patchoatd
# TODO: document why this is needed.
ART_GTEST_proxy_test_HOST_DEPS := $(HOST_CORE_IMAGE_default_no-pic_64) $(HOST_CORE_IMAGE_default_no-pic_32)
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 @@
// 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.
diff --git a/test/080-oom-throw-with-finalizer/src/Main.java b/test/080-oom-throw-with-finalizer/src/Main.java
index 57e9721..61a1b75 100644
--- a/test/080-oom-throw-with-finalizer/src/Main.java
+++ b/test/080-oom-throw-with-finalizer/src/Main.java
@@ -59,13 +59,22 @@
// Keep holder alive to make instance OOM happen faster.
holder = new char[128 * 1024][];
if (!triggerArrayOOM(holder)) {
+ // The test failed here. To avoid potential OOME during println,
+ // make holder unreachable.
+ holder = null;
System.out.println("NEW_ARRAY did not throw OOME");
}
if (!triggerInstanceFinalizerOOM()) {
+ // The test failed here. To avoid potential OOME during println,
+ // make holder unreachable.
+ holder = null;
System.out.println("NEW_INSTANCE (finalize) did not throw OOME");
}
+ // Make holder unreachable here so that the Sentinel
+ // allocation in runFinalization() won't fail.
+ holder = null;
System.runFinalization();
}
}