Revert "Revert "Add consistency CHECKs around ArtMethod fields.""
This reverts commit eeae32ba02c7d3785a8d195e967febfaa0b1113b.
Bug: 146765723
Reason for revert: Change can now land after:
https://android-review.googlesource.com/c/platform/art/+/1236946
Change-Id: I082c1cd20b8af4f83a5c7bb7853badcbe2ecb38b
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 5356637..93ccfc6 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()));
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 363fe25..1962ba2 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -1021,6 +1021,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;
}