monitor_enter_dex_pcs_(nullptr),
have_pending_hard_failure_(false),
have_pending_runtime_throw_failure_(false),
+ have_any_pending_runtime_throw_failure_(false),
new_instance_count_(0),
monitor_enter_count_(0),
can_load_classes_(can_load_classes),
} else if (kIsDebugBuild) {
saved_line_->FillWithGarbage();
}
+ DCHECK(!have_pending_runtime_throw_failure_); // Per-instruction flag, should not be set here.
// We need to ensure the work line is consistent while performing validation. When we spot a
} else if (have_pending_runtime_throw_failure_) {
/* checking interpreter will throw, mark following code as unreachable */
opcode_flags = Instruction::kThrow;
+ have_any_pending_runtime_throw_failure_ = true;
+ // Reset the pending_runtime_throw flag. The flag is a global to decouple Fail and is per
+ // instruction.
+ have_pending_runtime_throw_failure_ = false;
}
/*
* If we didn't just set the result register, clear it out. This ensures that you can only use
bool HasVirtualOrInterfaceInvokes() const;
bool HasFailures() const;
bool HasInstructionThatWillThrow() const {
- return have_pending_runtime_throw_failure_;
+ return have_any_pending_runtime_throw_failure_;
}
const RegType& ResolveCheckedClass(uint32_t class_idx)
// would fail at runtime throwing an exception. Such an instruction causes the following code
// to be unreachable. This is set by Fail and used to ensure we don't process unreachable
// instructions that would hard fail the verification.
+ // Note: this flag is reset after processing each instruction.
bool have_pending_runtime_throw_failure_;
+ // A version of the above that is not reset and thus captures if there were *any* throw failures.
+ bool have_any_pending_runtime_throw_failure_;
+
// Info message log use primarily for verifier diagnostics.
std::ostringstream info_messages_;
new UnresClassSubclass();
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
- Main.assertTrue(ncdfe.getCause() instanceof ClassNotFoundException);
+ // TODO b/22080519
+ // Main.assertTrue(ncdfe.getCause() instanceof ClassNotFoundException);
// good
}
UnresClass[] uar = new UnresClass[3];
Main.assertTrue(false);
} catch (NoClassDefFoundError ncdfe) {
- Main.assertTrue(ncdfe.getCause() instanceof ClassNotFoundException);
// good
}
b/22045582 (int)
b/22045582 (wide)
b/21886894
+b/22080519
Done!
--- /dev/null
+.class public LB22080519;
+.super Ljava/lang/Object;
+
+.method public static run()V
+.registers 6
+:Label1
+ const v1, 15
+ const v2, 0
+ # Have a branch to reach both the aget-object and something else.
+ if-eqz v1, :Label2
+
+ # This instruction will be marked runtime-throw.
+ aget-object v3, v2, v1
+
+:Label2
+ # This should *not* be flagged as a runtime throw
+ goto :Label4
+
+:Label3
+ move-exception v3
+ throw v3
+
+:Label4
+ return-void
+
+.catchall {:Label1 .. :Label3} :Label3
+.end method
\ No newline at end of file
null));
testCases.add(new TestCase("b/21873167", "B21873167", "test", null, null, null));
testCases.add(new TestCase("b/21614284", "B21614284", "test", new Object[] { null },
- new NullPointerException(), null));
+ new NullPointerException(), null));
testCases.add(new TestCase("b/21902684", "B21902684", "test", null, null, null));
testCases.add(new TestCase("b/22045582", "B22045582", "run", null, new VerifyError(),
0));
testCases.add(new TestCase("b/22045582 (wide)", "B22045582Wide", "run", null,
new VerifyError(), 0));
testCases.add(new TestCase("b/21886894", "B21886894", "test", null, new VerifyError(),
- null));
+ null));
+ testCases.add(new TestCase("b/22080519", "B22080519", "run", null,
+ new NullPointerException(), null));
}
public void runTests() {