Fix some issues for deoptimizing runtime methods.
Don't dereference a null return value after deoptimizing a runtime
method since we don't classify the return type of a runtime method.
Right now we just re-execute idempotent runtime methods.
Bug: 33616143
Test: host run-test
Change-Id: Ifc81e0e466e46f1b39e632b6af0b5f330bce6413
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index 943562c..25d4dd6 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -562,8 +562,7 @@
new_dex_pc = dex_pc + instr->SizeInCodeUnits();
} else if (instr->Opcode() == Instruction::NEW_INSTANCE) {
DCHECK(deopt_method_type == DeoptimizationMethodType::kDefault);
- if (value.GetL()->IsString()) {
- DCHECK(!first);
+ if (!first && value.GetL()->IsString()) {
// It's possible to deoptimize at a NEW_INSTANCE dex instruction that's for a
// java string, which is turned into a call into StringFactory.newEmptyString();
// Move the StringFactory.newEmptyString() result into the destination register.
@@ -592,7 +591,8 @@
// an invoke, so that we don't have to decode the dex instruction to move
// result into the right vreg. All slow paths have been audited to be
// idempotent except monitor-enter/exit and invocation stubs.
- // TODO: move result and advance dex pc.
+ // TODO: move result and advance dex pc. That also requires that we can
+ // tell the return type of a runtime method, which we don't do currently.
new_dex_pc = dex_pc;
}
} else {
diff --git a/test/knownfailures.json b/test/knownfailures.json
index 20cfc34..4166454 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -207,7 +207,8 @@
"variant": "trace | stream"
},
{
- "tests": ["604-hot-static-interface",
+ "tests": ["597-deopt-runtime-method",
+ "604-hot-static-interface",
"612-jit-dex-cache",
"613-inlining-dex-cache",
"626-set-resolved-string"],