Add consistency CHECKs around ArtMethod fields.
The jitzygote approach relies on those CHECKs which are currently
guaranteed.
Bug: 119800099
Test: builds
Change-Id: Ie5bb57bdd9b3c28a2d9cab607db2cf858e1ec131
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index 34a165f..87ce674 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -2727,6 +2727,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 b7fab90..63b5ffd 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -987,6 +987,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;
}