Reland^2 "Add consistency CHECKs around ArtMethod fields."
This reverts commit 5945de03b6f6b35bcf6a575b2291e29ae7a2b1ee.
Reason for revert: CL can land now after
https://android-review.googlesource.com/c/platform/art/+/1246288
Bug: 146765723
Change-Id: I237b1e171d94d47a39b21ec8b33cffa0b087b285
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 5356637..b04f26e 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -2493,6 +2493,10 @@
// We arrive here if we have found an implementation, and it is not in the ImtConflictTable.
// We create a new table with the new pair { interface_method, method }.
DCHECK(conflict_method->IsRuntimeMethod());
+
+ // Classes in the boot image should never need to update conflict methods in
+ // their IMT.
+ CHECK(!Runtime::Current()->GetHeap()->ObjectIsInBootImageSpace(cls.Get())) << cls->PrettyClass();
ArtMethod* new_conflict_method = Runtime::Current()->GetClassLinker()->AddMethodToConflictTable(
cls.Get(),
conflict_method,
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index 8ae57ff..8a27370 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -1024,6 +1024,10 @@
// such methods, we need their entrypoints to be stubs that do the
// initialization check.
header.VisitPackedArtMethods([&](ArtMethod& method) NO_THREAD_SAFETY_ANALYSIS {
+ // Methods in the boot image should never have their single
+ // implementation flag set (and therefore never have a `data_` pointing
+ // to an ArtMethod for single implementation).
+ CHECK(method.IsIntrinsic() || !method.HasSingleImplementationFlag());
if (method.IsRuntimeMethod()) {
return;
}